G3dBasic.mesa
Copyright Ó 1984, 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, July 14, 1992 1:49 pm PDT
Glassner, July 5, 1989 7:03:05 pm PDT
DIRECTORY G2dBasic, G2dMatrix, IO, Rope, Vector2;
G3dBasic: CEDAR DEFINITIONS
~ BEGIN
Basic Types
ROPE:      TYPE ~ Rope.ROPE;
STREAM:     TYPE ~ IO.STREAM;
Pair:      TYPE ~ G2dBasic.Pair;     -- RECORD [x, y: REAL ¬ 0.0]
Triple:     TYPE ~ G2dBasic.Triple;    -- RECORD [x, y, z: REAL ¬ 0.0];
NatPair:     TYPE ~ G2dBasic.NatPair;    -- RECORD [x, y: NAT ¬ 0];
IntPair:     TYPE ~ G2dBasic.IntPair;    -- RECORD [x, y: INT ¬ 0];
IntegerPair:    TYPE ~ G2dBasic.IntegerPair;   -- RECORD [x, y: INTEGER ¬ 0];
Quad:      TYPE ~ RECORD [x, y, z, w: REAL ¬ 0.0];
Miscellaneous Types
Sign:      TYPE ~ G2dBasic.Sign;     -- {positive, negative}
Border:     TYPE ~ G2dBasic.Border;    -- {inside, outside, edge}
Box:      TYPE ~ RECORD [min, max: Triple]; -- 3d bounding box
Hull:      TYPE ~ RECORD [      -- elaborate bounding box
center:       Triple ¬ origin,     -- center of hull
pMin, pMax:      Triple ¬ origin,     -- min and max points
rMin, rMax:      REAL ¬ 0.0      -- min and max radii
];
Segment:     TYPE ~ RECORD [p0, p1: Triple];  -- 3d line segment
Screen:     TYPE ~ RECORD [
quad:        Quad ¬ [],     -- homogeneous location
pos:        Pair ¬ [0, 0],     -- screen space position
intPos:       IntegerPair ¬ [0, 0],   -- screen space position in integers
visible:       BOOL ¬ TRUE,    -- 3d point in viewing frustum?
l, r, b, t, n, f:     BOOL ¬ FALSE,    -- l, r, b. t, n, f clip?
fwdFacing:      BOOL ¬ TRUE    -- if vertex normal forward facing
];
Surface:     TYPE ~ RECORD [      -- descriptor of polygon/patch
clientData:      REF ANY ¬ NIL,     -- surface's private data
vertices:       NatSequence ¬ NIL    -- vertex indices in shape
]; 
Ray:      TYPE ~ RECORD [base, axis: Triple];
Circle:     TYPE ~ RECORD [      -- 3d circle
center, normal:     Triple ¬ origin,
radius:       REAL ¬ 0.0
];
Sphere:     TYPE ~ RECORD [center: Triple, radius: REAL ¬ 0.0];
Triad:      TYPE ~ RECORD [
v, n, b:       Triple ¬ origin    -- vector, principal normal, binormal
];         -- see Computational Geometry for Design and Manufacture
Frame:     TYPE ~ RECORD [
position:      Triple ¬ origin,    -- position on curve
triad:       Triad ¬ [origin,origin,origin] -- triad (right-handed)
];
Intersection:    TYPE ~ RECORD [
point:        Triple ¬ origin,
doesIntersect:      BOOL ¬ TRUE
];
Sequences
NatSequence:    TYPE ~ G2dBasic.NatSequence;
NatSequenceRep:   TYPE ~ G2dBasic.NatSequenceRep;
IntegerSequence:   TYPE ~ G2dBasic.IntegerSequence;
IntegerSequenceRep:  TYPE ~ G2dBasic.IntegerSequenceRep;
IntSequence:    TYPE ~ G2dBasic.IntSequence;
IntSequenceRep:   TYPE ~ G2dBasic.IntSequenceRep;
RealSequence:   TYPE ~ G2dBasic.RealSequence;
RealSequenceRep:  TYPE ~ G2dBasic.RealSequenceRep;
PairSequence:   TYPE ~ G2dBasic.PairSequence;
PairSequenceRep:  TYPE ~ G2dBasic.PairSequenceRep;
NatPairSequence:  TYPE ~ G2dBasic.NatPairSequence;
NatPairSequenceRep: TYPE ~ G2dBasic.NatPairSequenceRep;
IntegerPairSequence: TYPE ~ G2dBasic.IntegerPairSequence;
IntegerPairSequenceRep: TYPE ~ G2dBasic.IntegerPairSequenceRep;
IntPairSequence:   TYPE ~ G2dBasic.IntPairSequence;
IntPairSequenceRep:  TYPE ~ G2dBasic.IntPairSequenceRep;
BoolSequence:   TYPE ~ REF BoolSequenceRep;
BoolSequenceRep:  TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF BOOL
];
NatTable:     TYPE ~ REF NatTableRep;
NatTableRep:    TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF NatSequence
];
TripleSequence:   TYPE ~ G2dBasic.TripleSequence;
TripleSequenceRep:  TYPE ~ G2dBasic.TripleSequenceRep;
QuadSequence:   TYPE ~ REF QuadSequenceRep;
QuadSequenceRep:  TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF Quad
];
SegmentSequence:  TYPE ~ REF SegmentSequenceRep;
SegmentSequenceRep: TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF Segment
];
SurfaceSequence:  TYPE ~ REF SurfaceSequenceRep;
SurfaceSequenceRep: TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF Surface
];
RefSequence:    TYPE ~ REF RefSequenceRep;
RefSequenceRep:   TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF REF
];
Constants
origin:     Triple ~ [0.0, 0.0, 0.0];
xAxis:      Triple ~ G2dBasic.xAxis;
yAxis:     Triple ~ G2dBasic.yAxis;
zAxis:      Triple ~ G2dBasic.zAxis;
PI:       REAL ~ G2dBasic.PI;
Sequence Operations
Additional Sequences Operations: see G2dVector, G3dMatrix, and G3dSpline
Miscellany
TripleSequenceFromList: PROC [LIST OF Triple] RETURNS [TripleSequence];
Return a sequence given a list.
Copying
CopyBoolSequence: PROC [bools: BoolSequence] RETURNS [BoolSequence];
Return a copy of the input BoolSequence.
CopyNatTable: PROC [nats: NatTable] RETURNS [NatTable];
Return a copy of the input NatTable.
CopyTripleSequence: PROC [triples: TripleSequence] RETURNS [TripleSequence];
Return a copy of the input sequence of triples.
CopyQuadSequence: PROC [quads: QuadSequence] RETURNS [QuadSequence];
Return a copy of the input sequence of quads.
CopySegmentSequence: PROC [segments: SegmentSequence] RETURNS [SegmentSequence];
Return a copy of the input sequence of segments.
CopySurfaceSequence: PROC [surfaces: SurfaceSequence] RETURNS [SurfaceSequence];
Return a copy of the input sequence of surfaces.
CopyRefSequence: PROC [refs: RefSequence] RETURNS [RefSequence];
Return a copy of the input sequence of REFs.
Adding To
AddToBoolSequence: PROC [bools: BoolSequence, bool: BOOL] RETURNS [BoolSequence];
Add bool to the sequence.
AddToNatTable: PROC [nats: NatTable, natSequence: NatSequence] RETURNS [NatTable];
Add natSequence to the sequence.
AddToTripleSequence: PROC [triples: TripleSequence, triple: Triple]
RETURNS [TripleSequence];
Add triple to the sequence.
AddToQuadSequence: PROC [quads: QuadSequence, quad: Quad] RETURNS [QuadSequence];
Add quad to the sequence.
AddToSegmentSequence: PROC [segments: SegmentSequence, segment: Segment]
RETURNS [SegmentSequence];
Add segment to the sequence.
AddToSurfaceSequence: PROC [surfaces: SurfaceSequence, surface: Surface]
RETURNS [SurfaceSequence];
Add surface to the sequence.
AddToRefSequence: PROC [refs: RefSequence, ref: REF] RETURNS [RefSequence];
Add refAny to the sequence.
Lengthening
LengthenBoolSequence: PROC [bools: BoolSequence, amount: REAL ¬ 1.3]
RETURNS [BoolSequence];
Return a copy of the input sequence whose maxLength is amount*input.maxLength.
LengthenNatTable: PROC [nats: NatTable, amount: REAL ¬ 1.3] RETURNS [NatTable];
Return a copy of the input sequence whose maxLength is amount*input.maxLength.
LengthenTripleSequence: PROC [triples: TripleSequence, amount: REAL ¬ 1.3]
RETURNS [TripleSequence];
Return a copy of the input sequence whose maxLength is amount*input.maxLength.
LengthenQuadSequence: PROC [quads: QuadSequence, amount: REAL ¬ 1.3]
RETURNS [QuadSequence];
Return a copy of the input sequence whose maxLength is amount*input.maxLength.
LengthenSegmentSequence: PROC [segments: SegmentSequence, amount: REAL ¬ 1.3]
RETURNS [SegmentSequence];
Return a copy of the input sequence whose maxLength is amount*input.maxLength.
LengthenSurfaceSequence: PROC [surfaces: SurfaceSequence, amount: REAL ¬ 1.3]
RETURNS [SurfaceSequence];
Return a copy of the input sequence whose maxLength is amount*input.maxLength.
LengthenRefSequence: PROC [refs: RefSequence, amount: REAL ¬ 1.3]
RETURNS [RefSequence];
Return a copy of the input sequence whose maxLength is amount*input.maxLength.
END.