GGSegment.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited by Bier on July 10, 1985 4:23:05 pm PDT
Contents: Procedures which implement the Gargoyle segment classes.
Stone, August 5, 1985 3:25:55 pm PDT
DIRECTORY
GGModelTypes,
CubicSplines;
GGSegment: CEDAR DEFINITIONS =
BEGIN
Point: TYPE = GGModelTypes.Point;
Segment: TYPE = GGModelTypes.Segment;
SegmentClass: TYPE = GGModelTypes.SegmentClass;
Making Segments (much like the Imager interface)
MakeLine: PROC [p0, p1: Point] RETURNS [seg: Segment];
Create a straight line segment between the two points.
MakeBezier: PROC [p0, p1, p2, p3: Point] RETURNS [seg: Segment];
Create a Bezier segment which passed thru p0 and p3, guided by p1 and p2.
MakeConic: PROC [p0, p1, p2: Point, r: REAL] RETURNS [seg: Segment];
Let m be the midpoint of [p0, p2].
Let p be the point on [m, p1] such that Length[m, p]/Length[m, p1] = r.
The curve starts at p0, passes through p, and ends at p2.
It is a line if r=0; an ellipse if 0<r<1/2; a parabola if r=1/2; a hyperbola if 1/2<r<1.
The curve is bounded by the triangle [p0, p1, p2].
MakeArc: PROC [p0, p1, p2: Point] RETURNS [seg: Segment];
Circular Arc through the three points
MakeCubicSpline: PROC [cps: CubicSplines.KnotSequence, type: CubicSplines.SplineType] RETURNS[Segment];
Makes a segment of any of the types defined in CubicSplines. Expected to be used principally for interpolating splines and sequences of Bezier cubics
CopySegment: PROC [seg: Segment] RETURNS [copy: Segment];
ReverseSegment: PROC [seg: Segment];
FetchSegmentClass: PROC [type: ATOM] RETURNS [class: SegmentClass];
Currently implemented: $CubicSpline, $Bezier, $Conic, $Arc, $Line
Raises NotFound if class is not registered.
NotFound: SIGNAL;
END.