G2dMatrix.mesa
Copyright Ó 1988, 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, July 2, 1992 4:37 pm PDT
DIRECTORY G2dBasic, Imager;
G2dMatrix: CEDAR DEFINITIONS
~ BEGIN
singular: ERROR;
Type Declarations
Pair:   TYPE ~ G2dBasic.Pair;
Triple:  TYPE ~ G2dBasic.Triple;
Rectangle: TYPE ~ Imager.Rectangle;
Matrix:  TYPE ~ RECORD [row1, row2, row3: Triple];
      That is, [row1.x row1.y row1.z]
          [row2.x row2.y row2.z]
          [row3.x row3.y row3.z]
Basic 3 by 3 Matrix Operations
Identity: PROC RETURNS [Matrix];
Return the identity matrix.
Transpose: PROC [m: Matrix] RETURNS [Matrix];
Return the transpose of the matrix.
Determinant: PROC [m: Matrix] RETURNS [REAL];
Return the determinant of the matrix.
Adjoint: PROC [m: Matrix] RETURNS [Matrix];
Return the adjoint of the matrix.
Invert: PROC [m: Matrix] RETURNS [Matrix];
Invert the matrix.
Mul: PROC [left, rite: Matrix] RETURNS [Matrix];
Post multiply the left by the rite.
Rotate: PROC [mat: Matrix, radians: REAL] RETURNS [Matrix];
Rotate the matrix (right-handed) by the angle in radians.
Scale: PROC [mat: Matrix, scale: Pair] RETURNS [Matrix];
Scale the matrix by the scale pair.
Translate: PROC [mat: Matrix, translate: Pair] RETURNS [Matrix];
Translate the matrix by the translate pair.
Transform: PROC [p: Triple, mat: Matrix] RETURNS [Triple];
Post multiply the triple p by the matrix.
Transformation Miscellany
UnitSquareToQuadrilateral: PROC [p1, p2, p3, p4: Pair] RETURNS [Matrix];
Return 2d perspective transformation of unit square {(0,0), (0,1), (1,1), (1,0)} to quadrilateral.
QuadrilateralToRectangle: PROC [p1, p2, p3, p4: Pair, rectangle: Rectangle]
RETURNS [Matrix];
Return 2d perspective transformation of quadilateral to rectangle.
END.