Copyright (C) 1994, Digital Equipment Corp.
by Stephen Harrison and Steve Glassman
INTERFACEA Matrix.T is a simplified representation of a true 3 x 3 matrix. We assume the last column is always {0, 0, 1} so we do not explicitly hold it.Matrix2D ;
Here is the layout of the elements of our matrix. A number is the corresponding index into the array, `x' means the element is not held explicitly.
Column
0 1 2
+---+---+---+
0| 0 | 1 | x |
R +---+---+---+
o 1| 2 | 3 | x |
w +---+---+---+
2| 4 | 5 | x |
+---+---+---+
IMPORT R2;
TYPE T = ARRAY [0 .. 5] OF REAL;
CONST
Identity = T{1.0, 0.0, (* 0.0 *)
0.0, 1.0, (* 0.0 *)
0.0, 0.0}; (* 1.0 *)
PROCEDURE Scale(READONLY sx, sy: REAL): T;
PROCEDURE Translate(READONLY tx, ty: REAL): T;
PROCEDURE Rotate(READONLY radians: REAL): T;
positive radians are clockwise
PROCEDURE Concat(READONLY m, n: T): T; PROCEDURE Concat3(READONLY l, m, n: T): T; PROCEDURE Inverse (READONLY m: T): T; PROCEDURE Transform(READONLY m: T; READONLY p: R2.T): R2.T; END Matrix2D.