File: SVVector2d.mesa
Last edited by Bier on June 1, 1984 4:34:30 pm PDT
Author: Eric Bier on September 4, 1986 3:33:37 pm PDT
Contents: Routines for manipulation vectors in two dimensions
DIRECTORY
SV2d;
SVVector2d: CEDAR DEFINITIONS =
BEGIN
Point2d: TYPE = SV2d.Point2d;
TrigLineSeg: TYPE = SV2d.TrigLineSeg;
Vector2d: TYPE = SV2d.Vector2d;
VectorFromAngle: PROC [angle: REAL] RETURNS [vector: Vector2d];
angle must be in degrees in the range: -180 < angle <= 180.
vector is a unit vector.
VectorPlusAngle: PROC [v: Vector2d, degrees: REAL] RETURNS [rotatedV: Vector2d];
AngleFromVector: PROC [v: Vector2d] RETURNS [position: REAL];
AngleCCWBetweenVectors: PROC [v1, v2: Vector2d] RETURNS [difference: REAL];
difference will be in: 0 <= difference < 360. A clockwise angle
AngleCWBetweenVectors: PROC [v1, v2: Vector2d] RETURNS [difference: REAL];
difference will be in: 0 <= difference < 360. A counter-clockwise angle
SmallestAngleBetweenVectors: PROC [v1, v2: Vector2d] RETURNS [difference: REAL];
All angles in degrees. RETURNS ClockwiseAngle or CounterClockwiseAngle. Whichever is smaller. -180< difference <= 180.
Add: PROC [v1, v2: Vector2d] RETURNS [v1PlusV2: Vector2d];
Sub: PROC [v1, v2: Vector2d] RETURNS [v1MinusV2: Vector2d];
Scale: PROC [v: Vector2d, s: REAL] RETURNS [vTimesS: Vector2d];
Normalize: PROC [v: Vector2d] RETURNS [normV: Vector2d];
Negate: PROC [v: Vector2d] RETURNS [negV: Vector2d];
ElementwiseProduct: PROC [v1, v2: Vector2d] RETURNS [v1Timesv2: Vector2d];
DotProduct: PROC [v1, v2: Vector2d] RETURNS [scalar: REAL];
Magnitude: PROC [v: Vector2d] RETURNS [mag: REAL];
Distance: PROC [p1, p2: Point2d] RETURNS [dist: REAL];
MagnitudeSquared: PROC [v: Vector2d] RETURNS [magSquared: REAL];
DistanceSquared: PROC [p1, p2: Point2d] RETURNS [distSquared: REAL];
VectorFromPoints: PROC [tail, head: Point2d] RETURNS [vector: Vector2d];
RightNormalOfTrigLineSeg: PROC [seg: TrigLineSeg] RETURNS [normal: Vector2d];
LeftNormalOfTrigLineSeg: PROC [seg: TrigLineSeg] RETURNS [normal: Vector2d];
END.