File: SVVector3d.mesa
Last edited by Bier on May 29, 1987 4:59:29 pm PDT
Contents: Vector3d addition and multiplication and stuff like that.
DIRECTORY
SV3d, SVVector2d;
SVVector3d: CEDAR DEFINITIONS =
BEGIN
Point3d: TYPE = SV3d.Point3d;
Vector3d: TYPE = SV3d.Vector3d;
Vector2d: TYPE = SVVector2d.Vector2d;
Add: PROC [v1: Vector3d, v2: Vector3d] RETURNS [sumV: Vector3d];
Sub: PROC [v1: Vector3d, v2: Vector3d] RETURNS [v1Minusv2: Vector3d];
Scale: PROC [v: Vector3d, scalar: REAL] RETURNS [scaledV: Vector3d];
Normalize:
PROC [v: Vector3d]
RETURNS [normV: Vector3d];
Returns the unit vector with the same direction as v.
Negate: PROC [v: Vector3d] RETURNS [negV: Vector3d];
DotProduct: PROC [v1: Vector3d, v2: Vector3d] RETURNS [scalar: REAL];
ElementwiseProduct: PROC [v1: Vector3d, v2: Vector3d] RETURNS [prod: Vector3d];
CrossProduct: PROC [v1: Vector3d, v2: Vector3d] RETURNS [prodV: Vector3d];
AngleCCWBetweenVectors:
PROC [v1: Vector3d, v2: Vector3d]
RETURNS [degrees:
REAL];
The cross product v1 x v2 produces a vector. With the plane determined by v1 and v2 facing you, measure the counter-clockwise angle from v1 to v2.
Magnitude: PROC [v: Vector3d] RETURNS [magnitude: REAL];
Distance: PROC [p1, p2: Point3d] RETURNS [dist: REAL];
MagnitudeSquared: PROC [v: Vector3d] RETURNS [magSquared: REAL];
DistanceSquared: PROC [p1, p2: Point3d] RETURNS [distSquared: REAL];
VectorFromPoints: PROC [tail, head: Point3d] RETURNS [vector: Vector3d];
Parallel: PROC [v1, v2: Vector3d] RETURNS [BOOL];
Perpendicular: PROC [v1, v2: Vector3d] RETURNS [BOOL];
Vector2DAsXYVector: PROC [vXY: Vector2d] RETURNS [vZeroZ: Vector3d];
Vector2DAsYZVector: PROC [vYZ: Vector2d] RETURNS [vZeroX: Vector3d];
Vector2DAsZXVector: PROC [vZX: Vector2d] RETURNS [vZeroY: Vector3d];
ProjectOntoXYPlane: PROC [v: Vector3d] RETURNS [v2d: Vector2d];
ProjectOntoYZPlane: PROC [v: Vector3d] RETURNS [v2d: Vector2d];
ProjectOntoZXPlane: PROC [v: Vector3d] RETURNS [v2d: Vector2d];
END.