DIRECTORY Matrix3d, ThreeDBasics, Vector3d; Polygons3d: CEDAR DEFINITIONS ~ BEGIN origin: Triple ~ Vector3d.origin; xAxis: Triple ~ Vector3d.xAxis; yAxis: Triple ~ Vector3d.yAxis; zAxis: Triple ~ Vector3d.zAxis; Pair: TYPE ~ Vector3d.Pair; PairSequence: TYPE ~ Vector3d.PairSequence; PairSequenceRep: TYPE ~ Vector3d.PairSequenceRep; Triple: TYPE ~ Vector3d.Triple; TripleSequence: TYPE ~ Vector3d.TripleSequence; TripleSequenceRep: TYPE ~ Vector3d.TripleSequenceRep; Matrix: TYPE ~ Matrix3d.Matrix; NatTable: TYPE ~ ThreeDBasics.NatTable; NatSequence: TYPE ~ ThreeDBasics.NatSequence; Triangle: TYPE ~ RECORD [i0, i1, i2: INTEGER _ -1]; TriangleSequence: TYPE ~ REF TriangleSequenceRep; TriangleSequenceRep: TYPE ~ RECORD [ length: NAT _ 0, element: SEQUENCE maxLength: NAT OF Triangle ]; MinMaxPairs: TYPE ~ RECORD [min, max: Pair]; MinMaxTriples: TYPE ~ RECORD [min, max: Triple]; TriangleNormal: PUBLIC PROC [p0, p1, p2: Triple] RETURNS [Triple]; PolygonNormal: PUBLIC PROC [vertices: TripleSequence] RETURNS [Triple]; PolygonNormals: PUBLIC PROC [ polygons: REF NatTable, vertices: TripleSequence, normals: TripleSequence _ NIL] RETURNS [TripleSequence]; ApplyToFrontFacingPolygons: PUBLIC PROC [ proc: PROC[nPoly: NAT], polygons: REF NatTable, pairs: PairSequence, view: Matrix, normals: TripleSequence]; CopyPolygon: PUBLIC PROC [poly: REF NatSequence] RETURNS [copy: REF NatSequence]; ReversePolygon: PUBLIC PROC [poly: REF NatSequence] RETURNS [REF NatSequence]; CenterOfPolygon: PUBLIC PROC [poly: REF NatSequence, points: TripleSequence] RETURNS [Triple]; CentersOfPolygons: PUBLIC PROC [ polygons: REF NatTable, points: TripleSequence, centers: TripleSequence _ NIL] RETURNS [TripleSequence]; ProjectToXYPlane: PUBLIC PROC [ poly: REF NatSequence, points: TripleSequence, o, x, y: Triple] RETURNS [pairs: PairSequence]; GetMinMaxPairs: PUBLIC PROC [pairs: PairSequence] RETURNS [mm: MinMaxPairs]; GetMinMaxTriples: PUBLIC PROC [triples: TripleSequence] RETURNS [mm: MinMaxTriples]; SquarePairDistance: PUBLIC PROC [p0, p1: Pair] RETURNS [REAL]; SquareTripleDistance: PUBLIC PROC [p0, p1: Triple] RETURNS [REAL]; LengthenTriangleSequence: PUBLIC PROC [t: TriangleSequence] RETURNS [TriangleSequence]; Triangulate2Polygons: PUBLIC PROC [ poly0, poly1: REF NatSequence, points: TripleSequence] RETURNS [TriangleSequence]; END. าPolygons3d.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, February 26, 1987 7:27:19 pm PST Type Declarations Normal Procedures Return the unit-length normal for three vertices, p0, p1, and p2. The normal will face the viewer if the vertices appear in clockwise order. Return the normal for these vertices using Newell's technique (A Characterization of Ten Hidden-Surface Algorithms, ACM Computing Surveys, March, 1974) to minimize non- planarity distortion. The normal will face the viewer if the vertices appear in clockwise order. The normal's length is proportional to the area of the polygon. Return a sequence of polygon normals (one per polygon); store in normals if non-nil. Apply the given proc to all front-facing polygons. Miscellaneous Procedures Return a copy of the input sequence. Reverse the order of the sequence elements. Return the simple average (center) of the polygon vertices. Return the simple centers of the polygons, using centers if non-NIL. Return a sequence of pairs projected onto the xy plane. The origin of the plane is o, its x-axis is x and its y-axis is y. Return the minmax bounding box for this sequence of pairs. Return the minmax bounding box for this sequence of triples. Return the square of the distance between two pairs. Return the square of the distance between two triples. Triangle Procedures Return a copy of the input sequence but with greater maxLength. Triangulate between two presumably planar polygons; the technique is similar to that of Christiansen and Sederberg (Conversion of Complex Contour Line Definitions into Polygonal Element Mosaics, Siggraph, 1978) in which each polygon is mapped to a unit square to facilitate the vertex matching. ส˜šœ™Jšœ ฯmœ1™J™4J˜—šกœž œžœžœ˜BJ™6——š ™šกœž œ˜;Jšžœ˜J˜J™?J˜—šกœžœžœ˜#Jšœžœ%˜6Jšžœ˜J˜J™WJšœข=™YJšขœE™TJšœ™J™——Jšžœ˜J˜J˜—…— Œd