DIRECTORY Controls, Imager, ImagerPixelMap, IO, Rope, Vector3d, ViewerClasses; Contours: CEDAR DEFINITIONS IMPORTS Imager ~ BEGIN ROPE: TYPE ~ Rope.ROPE; STREAM: TYPE ~ IO.STREAM; Context: TYPE ~ Controls.Context; Control: TYPE ~ Controls.Control; Viewer: TYPE ~ ViewerClasses.Viewer; PixelMap: TYPE ~ ImagerPixelMap.PixelMap; Rectangle: TYPE ~ Imager.Rectangle; Color: TYPE ~ Imager.Color; RealIndex: TYPE ~ RECORD [n: NAT _ 0, alpha: REAL _ 0.0]; Pair: TYPE ~ Vector3d.Pair; -- RECORD [x, y: REAL] PairSequence: TYPE ~ Vector3d.PairSequence; PairSequenceRep: TYPE ~ Vector3d.PairSequenceRep; RealSequence: TYPE ~ Vector3d.RealSequence; RealSequenceRep: TYPE ~ Vector3d.RealSequenceRep; Contour: TYPE ~ REF ContourRep; ContourRep: TYPE ~ RECORD [ t: REAL _ 0.0, -- curve parameter, if known closed: BOOL _ FALSE, -- if true, last point connects to 1st circle: BOOL _ TRUE, -- if true, normals = points pairs: PairSequence _ NIL, -- 2d points on contour normals: PairSequence _ NIL, -- 2d normals of contour points percents: RealSequence _ NIL -- % along contour for each point ]; ContourSequence: TYPE ~ REF ContourSequenceRep; ContourSequenceRep: TYPE ~ RECORD [ length: NAT _ 0, element: SEQUENCE maxLength: NAT OF Contour ]; Span: TYPE ~ RECORD [y, x0, x1: INTEGER]; SpanSequence: TYPE ~ REF SpanSequenceRep; SpanSequenceRep: TYPE ~ RECORD [ length: NAT _ 0, element: SEQUENCE maxLength: NAT OF Span ]; ContourOK: PUBLIC PROC [contour: Contour] RETURNS [BOOL]; MinMax: PROC [contour: Contour] RETURNS [min, max: Pair]; Centroid: PROC [contour: Contour] RETURNS [Pair]; Area: PROC [contour: Contour] RETURNS [REAL]; Scale: PROC [contour: Contour, scale: REAL] RETURNS [Contour]; Offset: PROC [contour: Contour, offset: Pair] RETURNS [Contour]; Center: PROC [contour: Contour] RETURNS [Contour]; Orient: PROC [contour: Contour] RETURNS [Contour]; Smooth: PROC [contour: Contour] RETURNS [Contour]; Thin: PROC [contour: Contour, epsilon: REAL _ 3.0] RETURNS [Contour]; CirclePairs: PROC [nPairs: INTEGER] RETURNS [PairSequence]; Circle: PROC [nPairs: INTEGER] RETURNS [Contour]; Normals: PROC [contour: Contour] RETURNS [PairSequence]; Percents: PROC [contour: Contour] RETURNS [RealSequence]; AtPercent: PROC [contour: Contour, percent: REAL] RETURNS [RealIndex]; PercentPair: PROC [contour: Contour, percent: REAL] RETURNS [Pair]; PercentNormal: PROC [contour: Contour, percent: REAL] RETURNS [Pair]; Interpolate: PROC [contour0, contour1: Contour, alpha: REAL] RETURNS [Contour]; Sample: PROC [contour: Contour, nPairs: INTEGER] RETURNS [Contour]; Similar: PROC [contour0, contour1: Contour] RETURNS [REAL]; Spans: PROC [contour: Contour, rectangle: Rectangle] RETURNS [SpanSequence]; FillSpans: PROC [pm: PixelMap, spans: SpanSequence, color: CARDINAL]; Fill: PROC [context: Context, contour: Contour, color: Color _ Imager.black]; Outline: PROC [context: Context, contour: Contour, color: Color _ Imager.black]; OutlinePm: PROC [pm: PixelMap, contour: Contour, color: CARDINAL _ 0]; FillPm: PROC [pm: PixelMap, contour: Contour, color: CARDINAL]; Copy: PROC [contour: Contour] RETURNS [Contour]; CopySequence: PROC [contour: ContourSequence] RETURNS [ContourSequence]; Paint: PUBLIC PROC [contour: Contour, context: Context, paintNormals: BOOL _ FALSE]; FromControl: PROC [control: Control, t: REAL _ 0.0] RETURNS [Contour]; ToControl: PROC [control: Control, contour: Contour, repaint: BOOL _ TRUE]; Write: PROC [stream: STREAM, contour: Contour]; Read: PROC [stream: STREAM] RETURNS [Contour]; END. ŽContours.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, February 26, 1987 11:43:38 pm PST Types Attributes Return true if contour and contour.pairs are non-nil. Return the minimum and maximum of the contour. Return the center of the contour. Return contour area: + if clockwise, - if counterclockwise, 0 if not closed. Operations Return the input contour scaled by the given amount. Return the input contour offset by the given amount. Return the input contour centered about [0, 0]. Return the input contour after orienting it to start at the lowest point in y. Replace contour points with weighted local average. Remove redundant points (epsilon is the permissable angular degree deviation from straight). Circles Return the points of a circle. Return a circular contour of nPairs number of points. Normals and Percents Return the set of two-dimensional normals for the contour. Set the percentages of each point according to its distance along the contour. Return the index into contour.pairs which is percent percentage around the contour. Return the contour point at percent percentage around the contour. Return the (unitized) contour normal at percent percentage around the contour. Interpolation/ReSampling/Comparing Return the contour that is alpha*contour0+(1.0-alpha)*contour1. Return a sampled copy of contour. Return a measure of the similarity between the two contours: 0 => dissimilar, 1 => similar. Spans Create a sequence of scanline segments which constitue the pixelated contour region. Color the spans. Filling/Outlining Fill the contour with the current Imager color. Outline the contour with the current Imager color. Outline the contour with the given color. Fill the contour with the given color. Copying Return a copy of the input contour; the contour points and normals are copied. Return a copy of the input sequence. Painting Paint the given contour. To/From Controls Return the contour from control, normalized by viewer dimensions. Set the control with the given contour, scaled by its viewer dimensions. IO Write the given contour to the given stream. Read the given contour from the given stream. Κ˜šœ ™ Jšœ Οmœ1™J™4J™—š£œžœ"žœ ˜@J™4J™—š£œžœžœ ˜2J™/J™—š£œžœžœ ˜2J™NJ™—š£œžœžœ ˜2J™3J™—š£œžœžœžœ ˜EJ™\——š ™codeš£ œžœ žœžœ˜;L™L™—š£œžœ žœžœ ˜1J™5——š ™š£œžœžœ˜8J™:J™—š£œžœžœ˜9J™NJ™—š£ œžœžœžœ ˜FJ™SJ˜—š£ œžœžœžœ˜CJ™BJ™—š£ œžœžœžœ˜EJ™N——š "™"š£ œžœ&žœžœ ˜OJ™?J™—š£œžœžœžœ ˜CJ™!J™—š£œžœžœžœ˜;J™[——š ™š£œžœ*žœ˜LJ™T—J™š£ œžœ,žœ˜EJ™——š ™š£œžœC˜MJ™/J™—š£œžœC˜PJ™2J™—š£ œžœ)žœ˜FJ™)J™—š£œžœ)žœ˜?J™&——š ™š£œžœžœ ˜0J™NJ™—š£ œžœžœ˜HJ™$——š ™š £œžœžœ4žœžœ˜TJ™——š ™š£ œžœžœžœ ˜FJšœA™AJ™—š£ œžœ/žœžœ˜KJ™H——š ™š£œžœ žœ˜/J™,J™—š£œžœ žœžœ ˜.J™-J™——Jšžœ˜J˜J˜—…—Tκ