GGTransformImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited by Bier on August 19, 1985 2:38:35 pm PDT
Contents: A layer on top of ImagerTransformation for use in Gargoyle.
DIRECTORY
ImagerTransformation,
GGModelTypes,
GGTransform;
GGTransformImpl: CEDAR PROGRAM
IMPORTS ImagerTransformation
EXPORTS GGTransform =
BEGIN
Point: TYPE = GGModelTypes.Point;
Transform: PUBLIC PROC [m: ImagerTransformation.Transformation, p: Point] RETURNS [newP: Point] = {
result: ImagerTransformation.VEC;
result ← ImagerTransformation.Transform[m, [p[1], p[2]] ];
newP[result.x, result.y];
};
RotateAboutPoint: PUBLIC PROC [origin: Point, degrees: REAL] RETURNS [m: ImagerTransformation.Transformation] = {
m ← ImagerTransformation.Translate[ [-origin[1], -origin[2]] ];
m ← ImagerTransformation.PostRotate[m, degrees];
m ← ImagerTransformation.PostTranslate[m, [origin[1], origin[2]]];
};
ScaleAboutPoint: PUBLIC PROC [origin: Point, scalar: REAL] RETURNS [m: ImagerTransformation.Transformation] = {
m ← ImagerTransformation.Translate[ [-origin[1], -origin[2]] ];
m ← ImagerTransformation.PostScale[m, scalar];
m ← ImagerTransformation.PostTranslate[m, [origin[1], origin[2]]];
};
ScaleUnevenAboutPoint: PUBLIC PROC [origin: Point, scalarX: REAL, scalarY: REAL] RETURNS [m: ImagerTransformation.Transformation] = {
m ← ImagerTransformation.Translate[ [-origin[1], -origin[2]] ];
m ← ImagerTransformation.PostScale2[m, [scalarX, scalarY]];
m ← ImagerTransformation.PostTranslate[m, [origin[1], origin[2]]];
};
END.