G3dClip.mesa
Copyright Ó 1984, 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, July 14, 1992 1:49 pm PDT
DIRECTORY G3dBasic, G3dMatrix;
G3dClip: CEDAR DEFINITIONS
~ BEGIN
Type Declarations
Pair:    TYPE ~ G3dBasic.Pair;
Triple:   TYPE ~ G3dBasic.Triple;
Quad:    TYPE ~ G3dBasic.Quad;
NatSequence:  TYPE ~ G3dBasic.NatSequence;
TripleSequence: TYPE ~ G3dBasic.TripleSequence;
Matrix:   TYPE ~ G3dMatrix.Matrix;
ClippedPair:  TYPE ~ RECORD [c0, c1: Pair, off: BOOL];
ClippedTriple: TYPE ~ RECORD [c0, c1: Triple, off: BOOL];
Clipping operations on projected 3d points
Clipping is performed using the window edge coordinate algorithm (see Newman and Sproull,
2nd edition). The argument m is the transformation matrix (from object to view space).
Clipping is to the viewing frustum: -1.0 <= (x, y, z) <= 1.0; the format ratio is presumed 1.0.
Clipped: PROC [p: Triple, m: Matrix] RETURNS [BOOL];
Return true iff the point p is clipped.
Alphas: PROC [xp0, xp1: Quad] RETURNS [a0, a1: REAL, off: BOOL];
Return the parametric points of intersection of line xp0-xp1 with the viewing frustum.
Frustum: PROC [p0, p1: Triple, m: Matrix] RETURNS [ClippedTriple];
Clip the line defined by the two world-space points p0 and p1 after transformation by m against planes: x=w, x=-w, y=w, y=-w, z=0, and z=w; return c0 and c1 set to the new line view-space endpoints; off is true iff the line is totally clipped.
FrustumH: PROC [xp0, xp1: Quad] RETURNS [ClippedTriple];
Clip the line defined by the two homogeneous points xp0 and xp1.
FrustumD: PROC [xp0, xp1: Quad] RETURNS [ClippedPair];
As FrustumClipH except returns pairs.
NearH: PROC [q0, q1: Quad] RETURNS [ClippedPair];
Clip the line segment only at the z=w plane (ie., the eyepoint); thus there is no far clipping
and clipping in x and y occurs in Imager.
Polygon: PROC [points: TripleSequence, polygon: NatSequence]
RETURNS [clipped: BOOL, newPoints: TripleSequence, newPolygon: NatSequence];
Clip the input polygon against the clipping planes. If no clipping occured, clipped is false.
END.