CharacterizeCubic.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Maureen Stone, January 18, 1988 5:26:11 pm PST
Package for analyzing the characteristics of cubic segments
DIRECTORY
Cubic2 USING [Bezier],
Imager USING [VEC],
ImagerTransformation USING [Transformation];
CharacterizeCubic: CEDAR DEFINITIONS
~ BEGIN
Bezier: TYPE ~ Cubic2.Bezier;
VEC: TYPE ~ Imager.VEC;
Type: TYPE ~ {vanilla, loop, cusp, singleInflection, doubleInflection, degenerate};
These procedures efficiently determine whether a Bezier cubic has a loop, cusp, one or two inflection points. "Vanilla" means none of the above, "degenerate" means that the characterization cannot take place because the cubic is actually a straight line or point.
GetType: PROC [bezier: Bezier] RETURNS [Type];
Determines the type of Bezier curve
GetTypeFromMapped: PROC [pt: VEC] RETURNS [Type];
Call when pt has already been mapped into canonical form.
GetCanonicalPoint: PROC [bezier: Bezier] RETURNS [pt: VEC];
Map point with transformation that takes the cubic into canonical form.
SixPoints: PROC[from0,from1, from2, to0, to1, to2: VEC] RETURNS[transform: ImagerTransformation.Transformation];
Map "from" points onto "to" points, in numerical order
Colinear: SIGNAL;
Signalled if SixPoints can't construct a transformation
END.