DIRECTORY SV2d, SV3d; SVPolygon3d: CEDAR DEFINITIONS = BEGIN Matrix4by4: TYPE = SV3d.Matrix4by4; Point3d: TYPE = SV3d.Point3d; Polygon: TYPE = SV2d.Polygon; Vector3d: TYPE = SV3d.Vector3d; Poly3d: TYPE = REF Poly3dObj; Poly3dObj: TYPE = SV3d.Poly3dObj; Plane: TYPE = REF PlaneObj; PlaneObj: TYPE = SV3d.PlaneObj; CreatePoly: PROC [len: NAT] RETURNS [poly3d: Poly3d]; CircumHexagon: PROC [y: REAL, r: REAL] RETURNS [hex: Poly3d]; ClearPoly: PROC [poly: Poly3d]; AddPolyPoint: PROC [poly: Poly3d, point: Point3d] RETURNS [polyPlusPoint: Poly3d]; PutPolyPoint: PROC [poly: Poly3d, index: NAT, point: Point3d] RETURNS [newPoly: Poly3d]; PartPolyGetsPartPoly: PUBLIC PROC [fromPoly: Poly3d, fromStart: NAT, toPoly: Poly3d, toStart: NAT, duration: NAT] RETURNS [newPoly: Poly3d]; PlaneFromPoly3d: PROC [poly: Poly3d] RETURNS [plane: Plane]; NextPointProc: TYPE = PROC [] RETURNS [point: Point3d, done: BOOL _ FALSE]; PlaneFromClientPoints: PROC [nextPoint: NextPointProc] RETURNS [plane: Plane]; PlaneFromPointAndNormal: PROC [point: Point3d, normal: Vector3d] RETURNS [plane: Plane]; PlaneFromCoefficients: PROC [A, B, C, D: REAL] RETURNS [plane: Plane]; SignedPointToPlaneDistance: PROC [point: Point3d, plane: Plane] RETURNS [distance: REAL]; ClipPolyToPlane: PROC [poly: Poly3d, plane: Plane] RETURNS [clippedPoly: Poly3d]; ClipPolyToPlanes: PROC [poly: Poly3d, planes: LIST OF Plane] RETURNS [clippedPoly: Poly3d]; LineSegmentMeetsPlane: PROC [p1, p2: Point3d, plane: Plane] RETURNS [intersection: Point3d]; ClipLineSegmentToPlane: PROC [p1, p2: Point3d, plane: Plane] RETURNS [newP1, newP2: Point3d, newP1isP1, newP2isP2, nullSegment: BOOL]; ClipLineSegmentToPlanes: PROC [p1, p2: Point3d, planes: LIST OF Plane] RETURNS [newP1, newP2: Point3d, newP1isP1, newP2isP2, nullSegment: BOOL]; NormalOfPlane: PROC [plane: Plane] RETURNS [normal: Vector3d]; PointOnNormalSideOfPlane: PROC [point: Point3d, plane: Plane] RETURNS [BOOL]; Quadrant: TYPE = {inin, inout, outin, outout}; QuadrantOfPoint: PROC [point: Point3d, plane1, plane2: Plane] RETURNS [Quadrant]; ProjectPolyToXYPlane: PROC [poly3d: Poly3d] RETURNS [polygon: Polygon]; ProjectPolyToYZPlane: PROC [poly3d: Poly3d] RETURNS [polygon: Polygon]; ProjectPolyToXZPlane: PROC [poly3d: Poly3d] RETURNS [polygon: Polygon]; TransformByMat: PROC [poly3d: Poly3d, mat: Matrix4by4] RETURNS [newPoly: Poly3d]; END. ϊFile: SVPolygon3d.mesa Author: Eric Bier on August 21, 1982 1:40 pm Last edited by Bier on August 11, 1987 12:42:39 pm PDT Contents: Most of the code necessary to describe the behavior of planes and polygons in space. (including the procedures necessary to make planar polygons act as master objects). Part of the Solidviews 3d Illustrator. Creates a hexigon which circumscribes the circle (in the Y = y plane) whose center is at [0, y, 0] and whose radius is r. toPoly in range [toStart..toStart+duration-1] gets fromPoly in range [fromStart..fromStart+duration-1]; Assumes that the normal of the plane should point in the direction such that if the normal points toward a viewer, the viewer will perceive the points of poly to run clockwise. Classifies point with respect to two planes. outin means the point is on the normal side of the first plane and the non-normal side of the other plane, etc. Perform the matrix transformation on every point of poly3d to get poly3d in a different coordinate frame. Κ0– "cedar" style˜Iheadšœ™Iprocšœ,™,Lšœ6™6Lšœά™άL˜šΟk ˜ Lšœ ˜ —L˜Lšœ œ˜ Lš˜˜Lšœ#˜#Lšœ œ˜Lšœ œ˜Lšœ œ˜L˜Lšœœœ ˜Lšœ œ˜!L˜Lšœœœ ˜Lšœ œ˜L˜—LšΟn œœœœ˜5š ž œœœœœ˜=Lšœy™y—Lšž œœ˜Lšž œœ œ˜RLšž œœœœ˜Xšžœœœœœ œœ˜ŒLšœg™g—L˜L˜Lšžœœœ˜Lšžœœ œœ˜MLšœ œ ˜.šžœœ)œ ˜QLšœ™—L˜Lšžœœœ˜GLšžœœœ˜GLšžœœœ˜GL˜šžœœ#œ˜QLšœi™i—L˜L˜Lšœ˜—…— Hr