<> <> <> <> <> <<>> <> <<>> DIRECTORY Vector2 USING [VEC]; ImagerTransform: CEDAR DEFINITIONS = BEGIN VEC: TYPE ~ Vector2.VEC; -- RECORD[x, y: REAL]; Pair: TYPE ~ VEC; Rectangle: TYPE ~ RECORD [x, y, w, h: REAL]; IntRectangle: TYPE ~ RECORD [x, y, w, h: INTEGER]; Ref: TYPE ~ REF Rep; Rep: TYPE ~ RECORD[a, b, c, d, e, f: REAL]; <> <> <> <> Transformation: TYPE ~ Ref; TransformationRec: TYPE ~ Rep; <> <<>> Contents: PROC[m: Ref] RETURNS[Rep] ~ INLINE { RETURN[m^] }; FromRec: PROC[Rep] RETURNS[Ref]; <> <<>> Create: PROC[a, b, c, d, e, f: REAL] RETURNS[Ref]; <> <<>> Copy: PROC[m: Ref] RETURNS[Ref]; <> <<>> Translate: PROC[x, y: REAL] RETURNS[Ref]; <> Scale: PROC[s: REAL] RETURNS[Ref]; <> Scale2: PROC[sx, sy: REAL] RETURNS[Ref]; <> <<>> Rotate: PROC[a: REAL] RETURNS[Ref]; <> <<>> Concat: PROC[m, n: Ref] RETURNS[Ref]; <> <<>> Invert: PROC[m: Ref] RETURNS[Ref]; <> <> <<>> PreMultiply: PROC[m, pre: Ref]; <> <<>> PreScale: PROC[m: Ref, s: REAL]; <> <<>> PreScale2: PROC[m: Ref, sx, sy: REAL]; <> <<>> PreRotate: PROC[m: Ref, a: REAL]; <> <<>> PreTranslate: PROC[m: Ref, x, y: REAL]; <> <<>> PostMultiply: PROC[m, post: Ref]; <> <<>> PostScale: PROC[m: Ref, s: REAL]; <> <<>> PostScale2: PROC[m: Ref, sx, sy: REAL]; <> <<>> PostRotate: PROC[m: Ref, a: REAL]; <> <<>> PostTranslate: PROC[m: Ref, x, y: REAL]; <> <<>> Get: PROC[m: Ref] RETURNS[Rep] ~ INLINE { RETURN[m^] }; <> <<>> Set: PROC[m: Ref, value: Rep] ~ INLINE { m^ _ value }; <> <<>> GetTrans: PROC[m: Ref] RETURNS[VEC] ~ INLINE { RETURN[[m.c, m.f]] }; <> <<>> SetTrans: PROC[m: Ref, value: VEC] ~ INLINE { m.c _ value.x; m.f _ value.y }; <> <<>> <<>> <> <<>> Transform: PROC[m: Ref, v: VEC] RETURNS[VEC]; <<"Point" transformation: [m.a*v.x + m.b*v.y + m.c, m.d*v.x + m.e*v.y + m.f].>> <<>> TransformVec: PROC[m: Ref, v: VEC] RETURNS[VEC]; <<"Vector" transformation: [m.a*v.x + m.b*v.y, m.d*v.x + m.e*v.y].>> <<>> InverseTransform: PROC[m: Ref, v: VEC] RETURNS[VEC]; <> <<>> InverseTransformVec: PROC[m: Ref, v: VEC] RETURNS[VEC]; <> <<>> <> <<>> CloseEnough: PROC [s, t: Transformation, rangeSize: REAL _ 2000.0] RETURNS [BOOLEAN]; <> CloseToTranslation: PROC [s, t: Transformation, rangeSize: REAL _ 2000.0] RETURNS [BOOLEAN]; <> <> <<>> TransformRectangle: PROC[m: Ref, rect: Rectangle] RETURNS[Rectangle]; TransformIntRectangle: PROC[m: Ref, rect: Rectangle] RETURNS[IntRectangle]; <> SingularValues: PROC [m: Ref] RETURNS [Pair]; <> END.