ImplicitPolygons.mesa
Copyright Ó 1985, 1990 by Xerox Corporation. All rights reserved.
Bloomenthal, February 26, 1993 3:24 pm PST
DIRECTORY G3dBasic, G3dMatrix, G3dOctree, G3dPolygon, ImplicitDefs, Rope;
ImplicitPolygons: CEDAR DEFINITIONS
~ BEGIN
NatSequence:   TYPE ~ G3dBasic.NatSequence;
SurfaceSequence: TYPE ~ G3dBasic.SurfaceSequence;
Matrix:    TYPE ~ G3dMatrix.Matrix;
Viewport:    TYPE ~ G3dMatrix.Viewport;
CrossSequence:  TYPE ~ G3dOctree.CrossSequence;
CrossPolygonProc: TYPE ~ G3dOctree.CrossPolygonProc;
Cube:     TYPE ~ G3dOctree.Cube;
CubeProc:   TYPE ~ G3dOctree.CubeProc;
PolygonProc:   TYPE ~ G3dPolygon.PolygonProc;
PolygonOkProc:  TYPE ~ ImplicitDefs.PolygonOkProc;
Surface:    TYPE ~ ImplicitDefs.Surface;
ValueProc:   TYPE ~ ImplicitDefs.ValueProc;
ROPE:     TYPE ~ Rope.ROPE;
Polygonization
CrossPolygonizeCube: PROC [
cube: Cube,
crossPolygonProc: CrossPolygonProc,
scratchCrossSequence: CrossSequence ¬ NIL,
recurseTrackFace: BOOL ¬ TRUE]
RETURNS [result: ATOM];
Apply crossPolygonProc to each of the polygons in cube. Crossings are presumed set.
Result is one of $Normal, $RecurseTracked, $RecurseFailed.
PolygonizeCube: PROC [
cube: Cube,
polygonProc: PolygonProc,
scratchPolygon: NatSequence ¬ NIL,
recurseTrackFace: BOOL ¬ TRUE]
RETURNS [result: ATOM];
Apply polygonProc to each of the polygons in cube. Crossings are presumed set.
Result is one of $Normal, $RecurseTracked, $RecurseFailed.
SetSurfacePolygons: PROC [
surface: Surface,
root: Cube,
triangulate: BOOL ¬ FALSE,
valueProc: ValueProc ¬ NIL,
threshold: REAL ¬ 0.0,
cubeProc: CubeProc ¬ NIL,
polygonOkProc: PolygonOkProc ¬ NIL,
clientData: REF ANY ¬ NIL]
RETURNS [message: ROPE];
Create the polygonized cube surface.
If non-NIL, use value to converge on cube's edge surface intersection.
cubeProc is useful to indicate status or test for abort.
Miscellany
ApplyToSurfacePolygons: PROC [surface: Surface, polygonProc: PolygonProc];
Apply polygonProc to each of the surface's polygons.
ApplyToFrontFacingPolygons: PROC [
surface: Surface,
view: Matrix,
viewport: Viewport,
polygonProc: PolygonProc];
Apply polygonProc to front facing polygons;
any polygon without an associated faceNormal is considered front-facing.
SetFaceNormalsCenters: PROC [surface: Surface, setNormals, setCenters: BOOL ¬ TRUE];
Set the surface's polygon normals, if setNormals.
Set the surface's polygon centers, if setCenters.
DecodePolygons: PROC [surface: Surface] RETURNS [SurfaceSequence];
Return a decoded SurfaceSequence from surface.polygons.
END.
..
GetTripoint: PROC [tripoints: TripointSequence, nTripoint: NAT] RETURNS [Tripoint]
~ INLINE {RETURN[tripoints[nTripoint]]};
Return triPoint n from the tripoints sequence.