GGSegment.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited by Bier on December 29, 1986 4:27:27 pm PST
Contents: Procedures which implement the Gargoyle segment classes.
Stone, August 5, 1985 3:25:55 pm PDT
Pier, October 28, 1986 5:18:56 pm PST
Kurlander August 28, 1986 6:13:29 pm PDT
DIRECTORY
CubicSplines, GGBasicTypes, GGInterfaceTypes, GGModelTypes, GGSegmentTypes, ImagerTransformation;
GGSegment: CEDAR DEFINITIONS = BEGIN
NotFound: SIGNAL;
BitVector: TYPE = GGModelTypes.BitVector;
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
Point: TYPE = GGBasicTypes.Point;
Segment: TYPE = GGSegmentTypes.Segment;
SegmentClass: TYPE = GGSegmentTypes.SegmentClass;
Vector: TYPE = GGBasicTypes.Vector;
ClassDef: TYPE = REF ClassDefRec;
ClassDefRec: TYPE = RECORD[type: ATOM, class: SegmentClass];
Making Segments (much like the Imager interface)
MakeLine:
PROC [p0, p1: Point, props:
LIST
OF
REF
ANY]
RETURNS [seg: Segment];
Create a straight line segment between the two points.
MakeBezier:
PROC [p0, p1, p2, p3: Point, props:
LIST
OF
REF
ANY]
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, props:
LIST
OF
REF
ANY]
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, props:
LIST
OF
REF
ANY]
RETURNS [seg: Segment];
Circular Arc through the three points
MakeCubicSpline:
PROC [cps: CubicSplines.KnotSequence, type: CubicSplines.SplineType, props:
LIST
OF
REF
ANY]
RETURNS [Segment];
Makes a segments of the types defined in CubicSplines.
General purpose segment routines
CopySegment: PROC [seg: Segment] RETURNS [copy: Segment];
ReverseSegment: PROC [seg: Segment];
OpenUpSegment: PROC [seg: Segment];
FetchSegmentClass:
PROC [type:
ATOM]
RETURNS [class: SegmentClass];
Currently implemented: $CubicSpline, $Bezier, $Conic, $Arc, $Line
Raises NotFound if class is not registered.
RegisterSegmentClass: PROC [classDef: ClassDef];
TransformSegment: PROC [seg: Segment, transform: ImagerTransformation.Transformation];
TranslateSegment: PROC [seg: Segment, vector: Vector];
MoveEndPointSegment:
PROC [seg: Segment, lo:
BOOL, newPoint: Point];
A convenience routine which does a TransformSegment, where transform is a simple translation.
Registers classes which may subsequently be found by FetchSegmentClass
Special purpose segment routines
CSControlPointAdd:
PROC [seg: Segment, pos: Point, gargoyleData: GargoyleData]
RETURNS [Segment];
Adds control points to segments of the CubicSpline class
CSControlPointDelete:
PROC [seg: Segment, cpVec: BitVector, gargoyleData: GargoyleData]
RETURNS [Segment];
Returns a CubicSpline Segment with selected control points deleted.
The following NoOp procedures are implemented by GGSegmentImplB.
NoOpTightBoxProc: GGSegmentTypes.TightBoxProc;
NoOpControlPointMoved: GGSegmentTypes.ControlPointMovedProc;
NoOpControlPointGet: GGSegmentTypes.ControlPointGetProc;
NoOpControlPointCount: GGSegmentTypes.ControlPointCountProc;
NoOpControlPointFieldSet: GGSegmentTypes.ControlPointFieldSetProc;
NoOpControlPointFieldGet: GGSegmentTypes.ControlPointFieldGetProc;
NoOpClosestControlPoint: GGSegmentTypes.ClosestControlPointProc;
NoOpClosestPointAndTangent: GGSegmentTypes.ClosestPointAndTangentProc;
NoOpLineIntersection: GGSegmentTypes.LineIntersectionProc;
NoOpCircleIntersection: GGSegmentTypes.CircleIntersectionProc;
NoOpAsSimpleCurve: GGSegmentTypes.AsSimpleCurveProc;
NoOpAddJoint: GGSegmentTypes.AddJointProc;
NoOpFileOut: GGSegmentTypes.FileOutProc;
NoOpFileIn is not allowed.
END.