G3dNavigate.mesa
Copyright Ó 1988, 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, July 15, 1992 4:04 pm PDT
DIRECTORY G3dBasic, G3dModel, G3dPlane, G3dPolygon;
G3dNavigate: CEDAR DEFINITIONS
~ BEGIN
Local Types
Spot:     TYPE ~ RECORD [point: Triple, pair: Pair, polygon: Polygon];
Intersection:   TYPE ~ RECORD [disjoint: BOOL ¬ TRUE, pt: Pair];
Seg:     TYPE ~ RECORD [p0, p1: Pair, line: Triple ¬ [0, 0, 0]];
Imported Types
Border:    TYPE ~ G3dBasic.Border;
NatPair:    TYPE ~ G3dBasic.NatPair;
NatSequence:   TYPE ~ G3dBasic.NatSequence;
SurfaceSequence:    TYPE ~ G3dBasic.SurfaceSequence;
Pair:     TYPE ~ G3dBasic.Pair;
PairSequence:  TYPE ~ G3dBasic.PairSequence;
PairSequenceRep: TYPE ~ G3dBasic.PairSequenceRep;
Quad:     TYPE ~ G3dBasic.Quad;
Triple:    TYPE ~ G3dBasic.Triple;
TripleSequence:  TYPE ~ G3dBasic.TripleSequence;
TripleSequenceRep: TYPE ~ G3dBasic.TripleSequenceRep;
Model:    TYPE ~ G3dModel.Model;
MajorPlane:   TYPE ~ G3dPlane.MajorPlane;
Polygon:    TYPE ~ G3dPolygon.Polygon;
Errors
Error: SIGNAL [reason: ATOM];
Navigating along a Polygonal Surface
PointFromPair: PROC [pair: Pair, poly: Polygon] RETURNS [Triple];
Return a 3d point with two elements from pair and the other such that
the point is on poly.plane; pair is presumed in poly.majorPlane.
poly.plane's normal is presumed unit length.
PairOn2dLine: PROC [pair: Pair, line: Triple] RETURNS [Border];
Return the status of the pair relative to the 2d line.
Intersect: PROC [s0, s1: Seg] RETURNS [Intersection];
Return the intersection of the two segments;
if a segment's line equations is [0, 0, 0], then it is computed.
MoveSpot: PROC [old: Spot, direction: Triple, distance: REAL] RETURNS [Spot];
Return old moved by distance in direction.
IntersectNextPoly: PROC [in, out: Spot] RETURNS [next: Spot];
Return spot on edge of next polygon; next.poly is the new polygon.
in is inside and out outside of the current polygon.
MoveOnPolygon: PROC [old: Spot, direction: Triple, distance: REAL] RETURNS [Spot];
Move distance along spot.poly starting from spot.pt towards direction.
! Error[$EndOfModel].
MoveToPolygonEdge: PROC [old: Spot, direction: Triple] RETURNS [Spot];
Move from spot.pt towards direction until encountering edge of spot.poly.
! Error[$NilProjectionVector].
END.