PolygonPen.mesa
Michael Plass, May 11, 1984 10:11:06 am PDT
Beach, February 9, 1985 9:08:33 pm PST
DIRECTORY
GraphicsBasic USING [Vec];
This module provides for the conversion of pen-drawn spline curves to spline-bounded outlines. The simplest kind of pen handled here is the broad pen, which is just a line segment. Polygonal-pen strokes are built up by means of multiple broad-pen strokes.
PolygonPen: CEDAR DEFINITIONS ~
BEGIN
Vec: TYPE ~ GraphicsBasic.Vec;
Bezier: TYPE ~ RECORD[b0, b1, b2, b3: Vec];
Pen: TYPE ~ REF PenRec;
PenRec:
TYPE ~
RECORD[point:
SEQUENCE n:
NAT
OF Vec];
The points define the outline of the polygon, with the reference point at the origin.
a broad pen is represented as a vector, with the reference point at the origin.
The results are sent by calling procedures of the following types:
MoveToProc: TYPE ~ PROCEDURE [z0: Vec];
LineToProc: TYPE ~ PROCEDURE [z1: Vec];
CurveToProc: TYPE ~ PROCEDURE [z1, z2, z3: Vec]; -- three Bezier control points. z3 is the new last point.
SimpleStroke: PROCEDURE [pen: Vec, curve: Bezier, moveTo: MoveToProc, lineTo: LineToProc, curveTo: CurveToProc]; -- for when the interior of the curve is known never to be parallel to the pen
BroadStroke: PROCEDURE [pen: Vec, curve: Bezier, moveTo: MoveToProc, lineTo: LineToProc, curveTo: CurveToProc]; -- for a compound stroke with a broad pen.
Dot: PROCEDURE [pen: Pen, point: Vec, moveTo: MoveToProc, lineTo: LineToProc, curveTo: CurveToProc];
Line: PROCEDURE [pen: Pen, startPoint, endPoint: Vec, moveTo: MoveToProc, lineTo: LineToProc, curveTo: CurveToProc];
Stroke: PROCEDURE [pen: Pen, curve: Bezier, moveTo: MoveToProc, lineTo: LineToProc, curveTo: CurveToProc];
END.