G3dBox.mesa
Copyright Ó 1985, 1992 by Xerox Corporation. All rights reserved.
Glassner, February 14, 1991 10:13 am PST
Jules Bloomenthal July 14, 1992 1:51 pm PDT
Ken Fishkin, August 25, 1992 1:16 pm PDT
DIRECTORY G3dBasic, G3dShape;
Imported Types
Box: TYPE ~ G3dBasic.Box;
NatSequence: TYPE ~ G3dBasic.NatSequence;
Surface: TYPE ~ G3dBasic.Surface;
Triple: TYPE ~ G3dBasic.Triple;
TripleSequence: TYPE ~ G3dBasic.TripleSequence;
VertexSequence: TYPE ~ G3dShape.VertexSequence;
Creation
BoxFromPoints:
PROC [p0, p1: Triple]
RETURNS [Box];
Return a box which contains the two points.
BoxFromSurface:
PROC [surf: Surface, verts: VertexSequence]
RETURNS [Box];
Return the box which contains the surface.
BoxFromVertices:
PROC [nats: NatSequence, verts: VertexSequence]
RETURNS [Box];
Return the smallest box which contains the vertices indicated in the sequence.
BoxFromTripleSequence:
PROC [ts: TripleSequence]
RETURNS [Box];
Return the smallest box which contains all points in the TripleSequence.
Tests
Intersect:
PROC [box1, box2: Box]
RETURNS [has:
BOOL, intersection: Box];
If the two boxes intersect, (has) is TRUE, and (intersection) is their intersection. If they do not intersect, (has) is FALSE, and (intersection) is undefined.
PointInBox:
PROC [box: Box, pt: Triple]
RETURNS [
BOOL];
Return TRUE iff the given point is inside the given box.
Utility Procs
Lerp:
PROC [alpha, low, high:
REAL]
RETURNS [
REAL];
Linear interpolation. When alpha=0, return low, when alpha=1, return high.
Min3d:
PROC [p0, p1: Triple]
RETURNS [Triple];
Return the component-wise minimum of two points.
Max3d:
PROC [p0, p1: Triple]
RETURNS [Triple];
Return the component-wise maximum of two points.