DIRECTORY G3dBasic, G3dMatrix, Rope; G3dPlane: CEDAR DEFINITIONS ~ BEGIN Error: ERROR [reason: ROPE]; Plane: TYPE ~ RECORD [x, y, z, w: REAL ¬ 0.0, normalized: BOOL ¬ FALSE]; MajorPlane: TYPE ~ {xy, xz, yz, unknown}; -- the xy, xz, or yz planes PlaneSequence: TYPE ~ REF PlaneSequenceRep; PlaneSequenceRep: TYPE ~ RECORD [ length: CARDINAL ¬ 0, element: SEQUENCE maxLength: NATURAL OF Plane ]; Circle: TYPE ~ G3dBasic.Circle; NatSequence: TYPE ~ G3dBasic.NatSequence; Pair: TYPE ~ G3dBasic.Pair; PairSequence: TYPE ~ G3dBasic.PairSequence; Ray: TYPE ~ G3dBasic.Ray; Sign: TYPE ~ G3dBasic.Sign; Triple: TYPE ~ G3dBasic.Triple; TripleSequence: TYPE ~ G3dBasic.TripleSequence; Matrix: TYPE ~ G3dMatrix.Matrix; ROPE: TYPE ~ Rope.ROPE; FromPolygon: PROC [points: TripleSequence, polygon: NatSequence ¬ NIL] RETURNS [Plane]; FromThreePoints: PROC [p1, p2, p3: Triple, unitize: BOOL ¬ FALSE] RETURNS [Plane]; FromThreePointsAndBehind: PROC [p1, p2, p3, behind: Triple, unitize: BOOL ¬ FALSE] RETURNS [Plane]; FromPointAndNormal: PROC [point, normal: Triple, unitize: BOOL ¬ FALSE] RETURNS [Plane]; DFromNormalAndPoints: PROC [ normal: Triple, points: TripleSequence, polygon: NatSequence ¬ NIL] RETURNS [REAL]; NormalFromPlane: PROC [plane: Plane, unit: BOOL ¬ FALSE] RETURNS [Triple]; Unit: PROC [plane: Plane] RETURNS [Plane]; IntersectionOf3: PROC [p1, p2, p3: Plane] RETURNS [Triple]; IntersectionOf2: PROC [plane1, plane2: Plane] RETURNS [Ray]; IntersectWithLine: PROC [plane: Plane, line: Ray] RETURNS [Triple]; ProjectPointToPlane: PROC [point: Triple, plane: Plane] RETURNS [Triple]; ProjectVectorToPlane: PROC [v: Triple, plane: Plane] RETURNS [Triple]; ProjectPointToMajorPlane: PROC [p: Triple, majorPlane: MajorPlane] RETURNS [Pair]; ProjectPointsToXYPlane: PROC [points: TripleSequence] RETURNS [PairSequence]; ProjectPointsToXZPlane: PROC [points: TripleSequence] RETURNS [PairSequence]; ProjectPointsToYZPlane: PROC [points: TripleSequence] RETURNS [PairSequence]; ProjectPointsToMajorPlane: PROC [points: TripleSequence, majorPlane: MajorPlane] RETURNS [PairSequence]; Side: PROC [point: Triple, plane: Plane] RETURNS [Sign]; Negate: PROC [plane: Plane] RETURNS [Plane]; AlignWithXYPlane: PROC [plane: Plane, out: Matrix ¬ NIL] RETURNS [Matrix]; ClosestPair: PROC [pairs: PairSequence, pair: Pair] RETURNS [NAT]; GetMajorPlane: PROC [plane: Plane] RETURNS [MajorPlane]; CenterOfPlane: PROC [plane: Plane] RETURNS [Triple]; DistanceToPoint: PROC [point: Triple, plane: Plane, unitize: BOOL ¬ TRUE] RETURNS [REAL]; CircleFromPoints: PROC [p1, p2, p3: Triple] RETURNS [Circle]; CopyPlaneSequence: PROC [planes: PlaneSequence] RETURNS [PlaneSequence]; AddToPlaneSequence: PROC [planes: PlaneSequence, plane: Plane] RETURNS [PlaneSequence]; LengthenPlaneSequence: PROC [planes: PlaneSequence, amount: REAL ¬ 1.3] RETURNS [PlaneSequence]; END. G3dPlane.mesa Copyright Σ 1984, 1992 by Xerox Corporation. All rights reserved. Bloomenthal, July 14, 1992 1:49 pm PDT Andrew Glassner February 19, 1991 4:06 pm PST Ken Fishkin, November 6, 1991 1:06 pm PST Errors Type Declarations Plane Creations Return unitized plane passing as close as possible to all points. If polygon # NIL, use as points index. Can raise Error[$NullVec, "points colinear"]. Return plane passing through three points, with normal pointing away if the three points appear in clockwise order; unitize the plane iff unitize is TRUE. Can raise Error[$NullVec, "null plane normal"]. Return plane passing through three points, with the normal oriented such that point (behind) is considered behind the plane. Return plane given point on plane and normal to plane; unitize the plane iff unitize is TRUE. Can raise Error[$NullVec, "null plane normal"]. Return distance from plane to origin. Return the normal to the plane. Plane Modifications Return unitized plane (i.e., plane normal is of unit length). Can raise Error[$NullVec, "null plane normal"]. Intersections Return point of intersection of planes. Can raise Error[$ZeroDiv, "no intersection"]. Return base and axis of line intersection of planes. Can raise Error[$NullVec, "no intersection"]. Return intersection point of plane and line. Can raise Error[$ZeroDiv, "no intersection"]. Projections Project point onto the plane, assuming the plane normal is of unit length. Project the vector onto the plane. Return p projected to the specified major plane. Project points onto the xy plane. Project points onto the xz plane. Project points onto the yz plane. Project points onto a major plane. Miscellany Return the which side of the plane point is on. Reverse the plane equation so the positive and negative half-spaces are swapped. Return the matrix that transforms points on plane to points on the xy plane. That is, the plane's center is transformed to the origin and the plane's normal is transformed to the z-axis. Use out if non-NIL. Return the index into pairs of that element of the sequence closest to pair. Return the major plane most aligned with plane. Return intersection of plane and line from origin normal to plane. Return the distance from a point to a plane. Distance is positive if point is in front, negative if behind, plane. Can raise Error[$NullVec, "null plane normal"]. If unitize, first unitize the plane equation. Find center and radius of circle passing through given three points. Can raise Error[$NullVec, "points collinear"]. Plane Sequences Κ•NewlineDelimiter –"cedarcode" style™™ Jšœ Οeœ6™BJ™&J™-J™)J˜JšΟk œ˜$J˜—JšΡblnœžœž ˜Jšœž˜headšΟl™JšΟnœžœ žœ˜—š ™š œ žœžœžœžœžœ˜KJ˜—šœ žœΟc˜IJ˜—Jšœžœžœ˜.šœžœžœ˜#Jšœžœ˜Jšœžœ žœžœ˜3J˜J˜—Jšœ žœ˜!Jšœžœ˜*Jšœ žœ˜Jšœžœ˜+Jšœžœ˜Jšœ žœ˜Jšœ žœ˜!Jšœžœ˜/Jšœ žœ˜"Jšžœžœžœ˜—š ™š‘ œžœ1žœžœ ˜WJ™AJšœ Οsœ™&J™-J™—š Πbnœžœžœžœžœ ˜RJ™QJšœC£œ™HJ™/J˜—š€œžœ'žœžœ˜RJšžœ ˜J™MJ™.J˜—š €œžΟbœ!žœžœ˜GJšžœ ˜J™6Jšœ!£œ2™WJ™—š‘œžœ˜J˜J˜Jšœžœ˜Jšžœžœ˜J™%J™—š ‘œžœžœžœžœ ˜JJ™——š ™š€œžœžœ ˜*J™=J™/——š  ™ š‘œžœžœ ˜;J™'J™-J˜—š‘œžœžœ˜