DIRECTORY Draw2d, Imager, Rope, Matrix3d, Spline3d, ThreeDBasics, Vector3d; Draw3d: CEDAR DEFINITIONS ~ BEGIN origin: Triple ~ Vector3d.origin; ROPE: TYPE ~ Rope.ROPE; Context: TYPE ~ Imager.Context; Pair: TYPE ~ Vector3d.Pair; Triple: TYPE ~ Vector3d.Triple; Quad: TYPE ~ Vector3d.Quad; Matrix: TYPE ~ Matrix3d.Matrix; Coeffs: TYPE ~ Spline3d.Coeffs; Bezier: TYPE ~ Spline3d.Bezier; PairSequence: TYPE ~ Vector3d.PairSequence; PairSequenceRep: TYPE ~ Vector3d.PairSequenceRep; TripleSequence: TYPE ~ Vector3d.TripleSequence; TripleSequenceRep: TYPE ~ Vector3d.TripleSequenceRep; NatTable: TYPE ~ ThreeDBasics.NatTable; NatSequence: TYPE ~ ThreeDBasics.NatSequence; DrawType: TYPE ~ Draw2d.DrawType; -- {solid, dashed, dotted} MarkType: TYPE ~ Draw2d.MarkType; -- {cross, x, asterisk, dot, none} PointProc: TYPE ~ PROC [context: Context, pair: Pair]; Mark: PUBLIC PROC [ context: Context, point: Triple, matrix: Matrix, label: ROPE _ NIL, markType: MarkType _ cross]; DoWithPoint: PUBLIC PROC [ context: Context, point: Triple, matrix: Matrix, pointProc: PointProc]; Segment: PUBLIC PROC [ context: Context, point0, point1: Triple, matrix: Matrix, drawType: DrawType _ solid]; Vector: PUBLIC PROC [ context: Context, base, vector: Triple, matrix: Matrix, label: ROPE _ NIL, scale: REAL _ 0.2, markType: MarkType _ none, drawType: DrawType _ solid]; Axes: PUBLIC PROC [context: Context, matrix: Matrix]; Curve: PUBLIC PROC [context: Context, coeffs: Coeffs, matrix: Matrix _ NIL]; DotCurve: PUBLIC PROC [context: Context, coeffs: Coeffs, matrix: Matrix _ NIL]; BezierPolygon: PUBLIC PROC [ context: Context, bezier: Bezier, matrix: Matrix _ NIL, drawType: DrawType _ solid, close: BOOL _ FALSE]; Triangle: PUBLIC PROC [ context: Context, p0, p1, p2: Triple, view: Matrix]; FrontFacingTriangle: PUBLIC PROC [ context: Context, p0, p1, p2: Triple, view: Matrix, normal: Triple _ origin]; PolygonPairs: PUBLIC PROC [ triples: TripleSequence, view: Matrix, pairs: PairSequence _ NIL] RETURNS [PairSequence]; Polygon: PUBLIC PROC [ context: Context, poly: REF NatSequence, pairs: PairSequence _ NIL, triples: TripleSequence _ NIL, view: Matrix _ NIL]; FrontFacingPolygon: PUBLIC PROC [ context: Context, poly: REF NatSequence, view: Matrix, normal: Triple _ origin, pairs: PairSequence _ NIL, triples: TripleSequence _ NIL]; Polygons: PUBLIC PROC [ context: Context, polygons: REF NatTable, pairs: PairSequence _ NIL, triples: TripleSequence _ NIL, view: Matrix _ NIL]; FrontFacingPolygons: PUBLIC PROC [ context: Context, polygons: REF NatTable, view: Matrix, normals: TripleSequence, pairs: PairSequence _ NIL, triples: TripleSequence _ NIL]; Pendant: PUBLIC PROC [ context: Context, view: Matrix, size: REAL _ .07, wPos, hPos: REAL _ .7, names: ARRAY [0..6) OF ROPE _ ALL[NIL]]; LabelPairs: PUBLIC PROC [context: Context, pairs: PairSequence]; END. Draw3d.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, February 26, 1987 7:27:17 pm PST Type Declarations Note In the following procedures, if a matrix has perspective, then, before being drawn, any transformed points are clipped against the viewing frustum. Point Marking Place a mark and optional label at the transformed point. Apply pointProc to the transformed point. No op if the transformed point is clipped from the viewing frustum. Straight Line Drawing Draw segment point0-point1. Draw and optionally label vector. The base is marked with mark. The label occurs about 6 pixels beyond the end of the vector, in the direction of the vector. Draw the coordinate axes. Curve Drawing Draw the curve, first transforming it if matrix is non-nil the number of curve segments is determined by Lane's formula. Draw the curve on the given context as above but as a series of dots. Draw the traditional three sides of the Bezier polygon; if close is true, draw the fourth side. Triangle Drawing Draw the triangle. Draw the triangle if it is front-facing. Polygon Drawing Return sequence of vertices transformed into screen space by view; store in pairs if non-nil. Draw a single polygon. If pairs is NIL then transform the appropriate triples by view. Either pairs must be non-NIL or both triples and view must be non-NIL. Draw the polygon if it is back-facing; normal is the polygon normal. if normal is the origin, compute it from triples; no-op if normal = origin and triples = NIL. If pairs is NIL then transform the appropriate triples by view. Draw the polygon sequence. If pairs is NIL then transform the triples by view. Either pairs must be non-NIL or both triples and view must be non-NIL. Draw the polygon sequence except for back-facing polygons. If pairs is NIL then transform the triples by view. normals are the polygon normals (one per polygon). Labelling Produce a screen pendant showing the directions. Naming order is is x, y, z,-x, -y, -z. Print the pair number next to the pair. ΚΏ˜šœ ™ Jšœ Οmœ1™