DIRECTORY Atom, Draw2d, G2dBasic, G3dBasic, G3dIO, G3dMatrix, G3dPlane, G3dPolygon, G3dShape, G3dSpline, IO, Rope; G3dModel: CEDAR DEFINITIONS ~ BEGIN Error: SIGNAL [code: ATOM, reason: ROPE]; ROPE: TYPE ~ Rope.ROPE; Context: TYPE ~ Draw2d.Context; DrawType: TYPE ~ Draw2d.DrawType; SplineSequence: TYPE ~ G3dSpline.SplineSequence; SurfaceSequence: TYPE ~ G3dBasic.SurfaceSequence; Pair: TYPE ~ G3dBasic.Pair; PairSequence: TYPE ~ G3dBasic.PairSequence; Ray: TYPE ~ G3dBasic.Ray; Segment: TYPE ~ G3dBasic.Segment; Triple: TYPE ~ G3dBasic.Triple; TripleSequence: TYPE ~ G3dBasic.TripleSequence; Matrix: TYPE ~ G3dMatrix.Matrix; Viewport: TYPE ~ G3dMatrix.Viewport; Plane: TYPE ~ G3dPlane.Plane; PolygonProc: TYPE ~ G3dPolygon.PolygonProc; PolygonSequence: TYPE ~ G3dPolygon.PolygonSequence; EdgeSequence: TYPE ~ G3dShape.EdgeSequence; ScreenSequence: TYPE ~ G3dShape.ScreenSequence; Shape: TYPE ~ G3dShape.Shape; ShapeSequence: TYPE ~ G3dShape.ShapeSequence; SurfaceProc: TYPE ~ G3dShape.SurfaceProc; STREAM: TYPE ~ IO.STREAM; Vertex: TYPE ~ G3dShape.Vertex; VertexSequence: TYPE ~ G3dShape.VertexSequence; Model: TYPE ~ REF ModelRep; -- stored on shape as modelData ModelRep: TYPE ~ RECORD [ points: TripleSequence _ NIL, -- sequence of 3d points polygons: PolygonSequence _ NIL, -- complex polygons curves: SplineSequence _ NIL -- for curved edges ]; NearModel: TYPE ~ RECORD [ point: Triple _ [], -- intersection point or nearest point noIntersection: BOOL _ TRUE, -- true iff point inside segment nPolygon: NAT _ 0 -- polygon index for nearest inter. pt. ]; ShapeFromFile: PROC [ fileName: ROPE, -- shape file name points: BOOL _ TRUE, -- set points sequence polygons: BOOL _ FALSE, -- set elaborate polygons faceCenters: BOOL _ TRUE, -- set shape.faceCenters faceNormals: BOOL _ TRUE, -- set shape.faceNormals edges: BOOL _ TRUE, -- set shape.edges curves: BOOL _ FALSE, -- set shape.curves normal: BOOL _ FALSE, -- set polygon normals (only if polygons is true) center: BOOL _ FALSE, -- set polygon centers (only if polygons is true) lines: BOOL _ FALSE, -- set polygon lines (only if polygons is true) accs: BOOL _ FALSE, -- set polygon accs (only if polygons is true) area: BOOL _ FALSE] -- set polygon area (only if polygons is true) RETURNS [Shape]; GetModel: PROC [shape: Shape] RETURNS [Model]; SetShape: PROC [ shape: Shape, -- original shape points: BOOL _ TRUE, -- set points sequence polygons: BOOL _ FALSE, -- set elaborate polygons faceCenters: BOOL _ TRUE, -- set shape.faceCenters faceNormals: BOOL _ TRUE, -- set shape.faceNormals edges: BOOL _ TRUE, -- set shape.edges curves: BOOL _ FALSE, -- set shape.curves normal: BOOL _ FALSE, -- set polygon normals (only if polygons is true) center: BOOL _ FALSE, -- set polygon centers (only if polygons is true) lines: BOOL _ FALSE, -- set polygon lines (only if polygons is true) accs: BOOL _ FALSE, -- set polygon accs (only if polygons is true) area: BOOL _ FALSE]; -- set polygon area (only if polygons is true) SetPoints: PROC [shape: Shape]; IsolateVertices: PROC [shape: Shape]; DeleteVertices: PROC [shape: Shape, vId0, vId1: NAT]; SetPolygons: PROC [ shape: Shape, normal, center, area, accs, lines: BOOL, complyWithVertices: BOOL _ TRUE]; CullBadPolygons: PROC [polygons: SurfaceSequence, maxNVertices: NAT]; IntersectWithRay: PROC [shape: Shape, ray: Ray] RETURNS [NearModel]; ClosestPoint: PROC [shape: Shape, point: Triple] RETURNS [NearModel]; ShapeFromRevolvedCurve: PROC [ curve: PairSequence, axis: Ray, res: NAT, start: NAT _ 0, stop: NAT _ LAST[NAT]] RETURNS [Shape]; ShapeFromPointsPolys: PROC [name: ROPE, points: TripleSequence, polys: SurfaceSequence] RETURNS [Shape]; ShapeFrom2dCurve: PROC [name: ROPE, curve: PairSequence] RETURNS [Shape]; ShapeFrom3dCurve: PROC [name: ROPE, curve: TripleSequence] RETURNS [Shape]; ShapeFromSegments: PROC [name: ROPE, segments: LIST OF Segment] RETURNS [Shape]; ShapeFromPoints: PROC [name: ROPE, points: TripleSequence] RETURNS [Shape]; SkipNPolys: PROC [shape: Shape, nPolys: NAT]; Cleave: PROC [shape: Shape, plane: Plane, cap: BOOL _ FALSE] RETURNS [neg, pos: Shape]; DrawCurves: PROC [ context: Context, shape: Shape, view: Matrix, viewport: Viewport _ [], type: DrawType _ solid, backFaces: BOOL _ TRUE, screens: ScreenSequence _ NIL, forceTransform: BOOL _ FALSE, forInterpress: BOOL _ FALSE] RETURNS [ScreenSequence]; SetCurves: PROC [shape: Shape]; MakeCurves: PROC [ vertices, normals: TripleSequence, edges: EdgeSequence, curves: SplineSequence _ NIL] RETURNS [SplineSequence]; NormalsFromCurve: PUBLIC PROC [curve: PairSequence] RETURNS [PairSequence]; END. Ψ G3dModel.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, July 21, 1992 10:42 am PDT Errors Imported Types Shape Definitions Record returned for closest point to a model or intersection of a model with a ray. If intersecting with ray, point is closest point to ray and noIntersection iff ray misses model. File IO Return the shape given in the file, setting those fields as specified. Shape Specification Return shape.modelData, if non-NIL, otherwise allocate and return Model. Set the specified shape attributes. Vertex Procedures Set shape.modelData.points. For each polygon in shape, allocate each of its vertices independently, so that a polygon vertex is no longer shared with its neighbors. Delete vertices numbered vId0 through vId1; renumber polygon vertex numbers accordingly; delete all polygons referencing these vertices. Polygon Procedures Set polygon.indices from shape.polys. Set various fields in the polygon record, depending on which of the following are true: normal: compute polygon.normal, the polygon's normal center: compute polygon.center, the polygon's center area: compute polygon.area, the polygon's area accs: compute polygon.accs, the accelerators for nearness testing lines: compute polygon.lines, the 2d line equations for edges in the majorPlane polygon.plane and polygon.majorPlane are always set. If complyWithVertices, ensure that polygon.normal and polygon.plane do not conflict with the surface normals. If complyWithVertices and shape.faces # NIL, shape.faces[n].normal is assumed to comply with shape.vertices[n].normal. Remove any polygons referring to vertices beyond maxNVertices. Nearness Procedures Find the intersection of ray with the shape. Find the closest point on the shape to point. Creation Return a shape consisting of a polygonal mesh created from revolving curve about axis. axialRes is the number of instances of the curve about the axis. Return a shape given the location of its vertices and polygon information. Create a shape from the curve, setting the curve in the z = 0 plane. Create a shape from the curve. Create a shape from a list of line segments. Polygonize a set of points, minimizing the resulting volume. Processing Eliminate the first nPolys polygons from the shape. Return those parts of shape on the negative and positive sides of plane. shape is presumed to contain only convex polygons. If cap, an additional polygon is caps the object at the slicing plane. Curve Procedures Draw the shape in the given context, according to shape.model.curves. If screens = NIL, it is allocated; screens is returned. If screens.valid or NOT forceTransform then screens are used directly to display; otherwise they are first computed according to the view matrix. Make curves connecting the polygon edges. Make curves connecting the polygon edges. Unit normals are created by rotating estimated tangents left 90" as we follow curve. If data is specified in the opposite order, the normals may be 180" out of phase. Κh•NewlineDelimiter ™™ Jšœ Οmœ1™——š ™š’œžœžœ ˜DJ™,J™—š’ œžœžœ ˜EJ™-——š ™š’œžœ˜J˜J˜ Jšœžœ˜ Jšœžœ˜Jšœžœžœžœ˜Jšžœ ˜J™VJ™@J™—š’œžœžœ1˜WJšžœ ˜J™JJ™—š’œžœžœžœ ˜IJ™DJ™—š’œžœžœžœ ˜KJ™J˜—š ’œžœžœ žœžœ žœ ˜PJ™,J™—š’œžœžœžœ ˜KJ™<——š  ™ š’ œžœžœ˜-J™3J™—š ’œžœ#žœžœžœ˜WJ™HJ™2J™F——š ™š’ œžœ˜J˜J˜ J˜ J˜J˜Jšœ žœžœ˜Jšœžœ˜Jšœžœžœ˜Jšœžœžœ˜Jšžœ˜J™EJšœ £œ'™7Jšœ£œ:™QJšœ?™?J™—š’ œžœ˜J™)J˜—š’ œžœ˜J˜"J˜Jšœžœ˜Jšžœ˜J™)J™—š ’œ£ž£ž£œ£œ ž£œ˜KJšœ?œ™TJšœBœ™Q——J˜Jšžœ˜J˜J˜—…—–%Φ