ImagerTransform.mesa
This interface provides the internal view of the procedures, structures, etc. involved in setting, modifying and using transformations in the imager.
Last Edited by:
Crow, July 31, 1983 3:28 pm
Plass, February 7, 1984 10:44:55 am PST
Wyatt, November 21, 1983 6:14 pm
ImagerTransform: CEDAR DEFINITIONS
= BEGIN
Pair: TYPE ~ RECORD [x, y: REAL];
Rectangle: TYPE ~ RECORD [x, y, w, h: REAL];
IntRectangle: TYPE ~ RECORD [x, y, w, h: INTEGER];
Transformation: TYPE ~ REF TransformationRep;
TransformationRep: TYPE ~ PRIVATE RECORD [a, b, c, d, e, f: --READONLY-- REAL];
TransformationRec: TYPE ~ RECORD [a, b, c, d, e, f: REAL];
Access to transformation fields.
Contents: PROC [m: Transformation] RETURNS [TransformationRec] ~ INLINE
{RETURN [[m.a, m.b, m.c, m.d, m.e, m.f]]};
These make new transformation matrices.
Translate: PROC [dx, dy: REAL] RETURNS [Transformation];
Scale: PROC [s: REAL] RETURNS [Transformation];
Scale2: PROC [sx, sy: REAL] RETURNS [Transformation];
Rotate: PROC [degrees: REAL] RETURNS [Transformation];
Concat: PROC [pre, post: Transformation] RETURNS [Transformation];
Invert: PROC [m: Transformation] RETURNS [Transformation];
Create: PROC [a, b, c, d, e, f: REAL] RETURNS [Transformation];
FromRec: PROC [t: TransformationRec] RETURNS [Transformation];
These are accelerators for the simple operations of premultiplying by a translate, scale, or rotate.
PreTranslate: PROC [dx, dy: REAL, m: Transformation] RETURNS [Transformation];
PreScale: PROC [s: REAL, m: Transformation] RETURNS [Transformation];
PreScale2: PROC [sx, sy: REAL, m: Transformation] RETURNS [Transformation];
PreRotate: PROC [degrees: REAL, m: Transformation] RETURNS [Transformation];
These apply the supplied transform (or its inverse) to the indicated type
Transform: PROC [p: Pair, transform: Transformation] RETURNS [Pair];
InverseTransform: PROC [p: Pair, transform: Transformation] RETURNS [Pair];
TransformVec: PROC [p: Pair, transform: Transformation] RETURNS [Pair];
InverseTransformVec: PROC [p: Pair, transform: Transformation] RETURNS [Pair];
These test for transformations that are close to each other.
CloseEnough: PROC [s, t: Transformation, rangeSize: REAL ← 2000.0] RETURNS [BOOLEAN];
Returns TRUE if for all points p such that Transform[p, s] is in [0, 0, rangeSize, rangeSize], Transform[p, s] and Transform[p, t] differ by at most 1/4 pixel.
CloseToTranslation: PROC [s, t: Transformation, rangeSize: REAL ← 2000.0] RETURNS [BOOLEAN];
Returns TRUE if for all points p such that TransformVec[p, s] is in [0, 0, rangeSize, rangeSize], TransformVec[p, s] and TransformVec[p, t] differ by at most 1/4 pixel.
These always return rectangles, thus "hard" transforms will cause a bounding box to be returned
TransformRectangle: PROC [rect: Rectangle, transform: Transformation] RETURNS [Rectangle];
TransformIntRectangle: PROC [rect: Rectangle, transform: Transformation] RETURNS [IntRectangle];
Computing singular values
SingularValues: PROC [transform: Transformation] RETURNS [Pair];
-- Returns the singular values of the non-translation portion of the transform. These are the square roots of the eigenvalues of the symmetric matrix MMT, where M is the non-translation portion. The x component is the larger of the two. These correspond to the maximum and minimum magnitudes that the image of a unit vector can achive.
END.