G3dClipVolume.mesa
Copyright Ó 1984, 1992 by Xerox Corporation. All rights reserved.
Glassner, February 18, 1991 9:27 pm PST
Jules Bloomenthal August 26, 1992 3:12 pm PDT
DIRECTORY G3dBasic, G3dBox, G3dNats, G3dShape, G3dPlane;
G3dClipVolume: CEDAR DEFINITIONS
~ BEGIN
Basic Types
Box: TYPE ~ G3dBox.Box;
Plane: TYPE ~ G3dPlane.Plane;
PlaneSequence: TYPE ~ G3dPlane.PlaneSequence;
Ray: TYPE ~ G3dPlane.Ray;
Shape: TYPE ~ G3dShape.Shape;
Triple: TYPE ~ G3dBasic.Triple;
Local Types
Note: This interface is designed to clip convex polygons against convex clipping volumes.
ClipVolume: TYPE ~ REF ClipVolumeRep;
ClipVolumeRep:
TYPE ~
RECORD [
planes: PlaneSequence ¬ NIL, -- inward-pointing planes of the volume
box: Box ¬ [] -- bounding box of the volume
];
TripleList: TYPE ~ LIST OF Triple;
Clip Volume Construction
ClipVolumeFrom4Points:
PROC [p0, p1, p2, p3: Triple]
RETURNS [ClipVolume];
Build a tetrahedral clipping volume from the four points.
Shape and Polygon Testing
ShapeInVolume:
PROC [shape: Shape, clipVolume: ClipVolume]
RETURNS [
BOOL];
Returns TRUE if any surface in the shape is within the ClipVolume
PolygonInVolume:
PROC [pts: TripleList, clipVolume: ClipVolume]
RETURNS [
BOOL];
Returns TRUE if the polygon represented by pts is within the ClipVolume
Utility
NegatePlane:
PROC [plane: Plane]
RETURNS [Plane];
Return the plane with opposite normal and adjusted offset
TripleListFromSurface:
PROC [shape: Shape, surfID:
INT]
RETURNS [TripleList];
Return the TripleList describing this surface
Volume Clipping
ClipToPlane:
PROC [vList: TripleList, plane: Plane]
RETURNS [TripleList];
The basic routine in this interface: return the TripleList resulting by clipping the input TripleList against the plane.
END.