Vector3.mesa
Copyright © 1984, Xerox Corporation. All rights reserved.
Doug Wyatt, August 15, 1984 5:42:30 pm PDT
Vector3: CEDAR DEFINITIONS
~ BEGIN
VEC: TYPE ~ RECORD[x, y, z: REAL];
Add: PROC[v1, v2: VEC] RETURNS[VEC];
Sum, v1+v2.
Sub: PROC[v1, v2: VEC] RETURNS[VEC];
Difference, v1-v2.
Neg: PROC[v: VEC] RETURNS[VEC];
Negative, -v.
Mul: PROC[v: VEC, s: REAL] RETURNS[VEC];
Product, sv.
Div: PROC[v: VEC, s: REAL] RETURNS[VEC];
Division, (1/s)v.
Square: PROC[v: VEC] RETURNS[REAL];
Length squared, v"v.
Length: PROC[v: VEC] RETURNS[REAL];
Length (magnitude), |v|.
Unit: PROC[v: VEC] RETURNS[VEC];
Unit vector, v/|v|.
Dot: PROC[v1, v2: VEC] RETURNS[REAL];
Dot (inner) product, v1"v2 = |v1| |v2| cos(theta).
Cross: PROC[v1, v2: VEC] RETURNS[VEC];
Cross (outer) product, v1 v2; |v1 v2| = |v1| |v2| sin(theta).
END.