-- COGSpaceImpl.mesa: Basic geometrical operations in Cartesian three-space (implem.)
-- last modified by Stolfi - September 29, 1982 8:10 pm
-- compile COGSpaceImpl
DIRECTORY
COGSpace;
COGSpaceImpl: CEDAR PROGRAM
EXPORTS COGSpace =
BEGIN OPEN COGSpace;
DoubleRot: PUBLIC PROC [u, v: Vector, c, s: REAL] RETURNS [ur, vr: Vector] =
{ur ← [u.x*c + v.x*s, u.y*c + v.y*s, u.z*c + v.z*s];
vr ← [v.x*c - u.x*s, v.y*c - u.y*s, v.z*c - u.z*s]};
Transf: PUBLIC PROC [u, xb, yb, zb: Vector] RETURNS [ut: Vector] =
{RETURN
[[x: u.x*xb.x + u.y*yb.x + u.z*zb.x,
y: u.x*xb.y + u.y*yb.y + u.z*zb.y,
z: u.x*xb.z + u.y*yb.z + u.z*zb.z]]};
END.