<> <> <> <> <> <<>> <> <<>> DIRECTORY Vector2 USING [VEC]; ImagerTransformation: CEDAR DEFINITIONS ~ BEGIN Transformation: TYPE ~ REF TransformationRep; TransformationRep: TYPE ~ RECORD[a, b, c, d, e, f: REAL]; <> <> <> <> <<>> VEC: TYPE ~ Vector2.VEC; -- RECORD[x, y: REAL]; <> <<>> Create: PROC[a, b, c, d, e, f: REAL] RETURNS[Transformation]; <> <<>> Copy: PROC[m: Transformation] RETURNS[Transformation]; <> <<>> Translate: PROC[t: VEC] RETURNS[Transformation]; <> Scale: PROC[s: REAL] RETURNS[Transformation]; <> Scale2: PROC[s: VEC] RETURNS[Transformation]; <> <<>> Rotate: PROC[a: REAL] RETURNS[Transformation]; <> <<>> Concat: PROC[m, n: Transformation] RETURNS[Transformation]; <> <<>> Cat: PROC[m1, m2, m3, m4, m5, m6: Transformation _ NIL] RETURNS[Transformation]; <> <<>> Invert: PROC[m: Transformation] RETURNS[Transformation]; <> <> <<>> PreMultiply: PROC[m, pre: Transformation]; <> <<>> PreScale: PROC[m: Transformation, s: REAL]; <> <<>> PreScale2: PROC[m: Transformation, s: VEC]; <> <<>> PreRotate: PROC[m: Transformation, a: REAL]; <> <<>> PreTranslate: PROC[m: Transformation, t: VEC]; <> <<>> PostMultiply: PROC[m, post: Transformation]; <> <<>> PostScale: PROC[m: Transformation, s: REAL]; <> <<>> PostScale2: PROC[m: Transformation, s: VEC]; <> <<>> PostRotate: PROC[m: Transformation, a: REAL]; <> <<>> PostTranslate: PROC[m: Transformation, t: VEC]; <> <<>> Get: PROC[m: Transformation] RETURNS[TransformationRep] ~ INLINE { RETURN[m^] }; <> <<>> Set: PROC[m: Transformation, value: TransformationRep] ~ INLINE { m^ _ value }; <> <<>> GetTrans: PROC[m: Transformation] RETURNS[VEC] ~ INLINE { RETURN[[m.c, m.f]] }; <> <<>> SetTrans: PROC[m: Transformation, t: VEC] ~ INLINE { m.c _ t.x; m.f _ t.y }; <> <<>> <> <<>> Transform: PROC[m: Transformation, 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: Transformation, 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: Transformation, v: VEC] RETURNS[VEC]; <> <<>> InverseTransformVec: PROC[m: Transformation, v: VEC] RETURNS[VEC]; <> <<>> <> <<>> DRound: PROC[v: VEC] RETURNS[VEC]; <> RoundXY: PROC[m: Transformation, v: VEC] RETURNS[VEC]; <> <<>> RoundXYVec: PROC[m: Transformation, v: VEC] RETURNS[VEC]; <> <<>> <> <<>> FactoredTransformation: TYPE ~ RECORD[ preRotate: REAL, -- degrees scale: VEC, postRotate: REAL, -- degrees translate: VEC ]; <> <<>> Factor: PROC[Transformation] RETURNS[FactoredTransformation]; Combine: PROC[FactoredTransformation] RETURNS[Transformation]; <<>> <<>> <> <<>> CloseEnough: PROC[s, t: Transformation, rangeSize: REAL _ 2000.0] RETURNS[BOOL]; <> CloseToTranslation: PROC[s, t: Transformation, rangeSize: REAL _ 2000.0] RETURNS[BOOL]; <> <> <<>> Rectangle: TYPE ~ RECORD [x, y, w, h: REAL]; IntRectangle: TYPE ~ RECORD [x, y, w, h: INTEGER]; TransformRectangle: PROC[m: Transformation, rect: Rectangle] RETURNS[Rectangle]; TransformIntRectangle: PROC[m: Transformation, rect: Rectangle] RETURNS[IntRectangle]; <> SingularValues: PROC[m: Transformation] RETURNS[VEC]; <> END.