File: SV3d.mesa
Author: Eric Bier on August 12, 1983 7:27 pm
Last edited by: Bier September 24, 1987 12:11:08 pm PDT
Contents: Definitions for three-dimensional types.
SV3d: DEFINITIONS =
BEGIN
Point3d: TYPE = ARRAY [1..3] OF REAL;
Vector3d: TYPE = ARRAY [1..3] OF REAL;
Matrix4by4: TYPE = ARRAY [1..3] OF ARRAY [1..4] OF REAL;
Line3d: TYPE = REF Line3dObj;
Line3dObj: TYPE = RECORD [
base is the closest point on the line to the origin. direction is the set of direction cosines of the line. Parametrically, the line is base + t * direction, for all Real t.
base: Point3d,
direction: Vector3d,
mat: Matrix4by4 -- the z axis of this mat is on line, the origin is base. mat is orthonormal.
];
Edge3d: TYPE = REF Edge3dObj;
Edge3dObj: TYPE = RECORD [
line: Line3d,
start, end: Point3d
];
Poly3d: TYPE = REF Poly3dObj;
Poly3dObj: TYPE = RECORD [
len: NAT, seq: SEQUENCE maxVerts: NAT OF Point3d];
PolyDatabase: TYPE = LIST OF Poly3d;
Plane: TYPE = REF PlaneObj;
PlaneObj: TYPE = RECORD [
A, B, C, D: REAL];
Plane equation: Ax + By + Cz + D = 0;
The normal vector is [A, B, C];
The y = 0 plane for instance has A = C = D = 0;
If B = 1 THEN normal is [0, 1, 0] pointing up. Plug in point (4, 5, 6) = 5 (pos, normal side, up).
If B = -1 THEN normal is [0, -1, 0] pointing down. Plug in point (4, 5, 6) = -5 (neg, not normal side, up).
Circle3d: TYPE = REF Circle3dObj;
Circle3dObj: TYPE = RECORD [
origin: Point3d,
radius: REAL,
plane: Plane
];
Sphere: TYPE = REF SphereObj;
SphereObj: TYPE = RECORD [
center: Point3d,
radius: REAL,
radiusSquared: REAL
];
END.