G2dSpline.mesa
Copyright Ó 1984, 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, July 1, 1992 7:08 pm PDT
DIRECTORY G2dBasic, Rope;
G2dSpline: CEDAR DEFINITIONS
~ BEGIN
Type Declarations
Pair:      TYPE ~ G2dBasic.Pair;
RealSequence:   TYPE ~ G2dBasic.RealSequence;
PairSequence:   TYPE ~ G2dBasic.PairSequence;
Spline1d:     TYPE ~ REF Spline1dRep;
Spline1dRep:    TYPE ~ ARRAY [0..4) OF REAL;
Spline1dSequence:  TYPE ~ REF Spline1dSequenceRep;
Spline1dSequenceRep: TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF Spline1d
];
Spline2d:     TYPE ~ REF Spline2dRep;
Spline2dRep:    TYPE ~ ARRAY [0..4) OF Pair;
Spline2dSequence:  TYPE ~ REF Spline2dSequenceRep;
Spline2dSequenceRep: TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF Spline2d
];
NearSpline:    TYPE ~ RECORD [
point:        Pair ¬ [0.0, 0.0],   -- point on 2d spline
t:         REAL ¬ 0.0,    -- parametric position
distance:       REAL ¬ 0.0    -- distance to spline
];
Error: ERROR [reason: Rope.ROPE];
1D Interpolation
Interpolate1d: PROC [
knots: RealSequence,
spline: Spline1dSequence ¬ NIL,
noOvershoot: BOOL ¬ FALSE]
RETURNS [Spline1dSequence];
Creates one-dimensional natural interpolating spline with chord-length parametrization.
Use spline if nonsNIL.
End tangents are zero.
If noOvershoot, clamp tangents to prevent spline from exceeding knot values
Interpolate2d: PROC [
knots: PairSequence,
spline: Spline2dSequence ¬ NIL]
RETURNS [Spline2dSequence];
Creates two-dimensional natural interpolating spline with chord-length parametrization.
Use spline if nonsNIL.
End tangents are zero.
Evaluation
Position1d: PROC [spline: Spline1d, t: REAL] RETURNS [REAL];
Return the point of the curve at position t.
Velocity1d: PROC [spline: Spline1d, t: REAL] RETURNS [REAL];
Return the unnormalized tangent of the curve at position t.
Acceleration1d: PROC [spline: Spline1d, t: REAL] RETURNS [REAL];
Return the unnormalized acceleration of the curve at position t.
Position2d: PROC [spline: Spline2d, t: REAL] RETURNS [Pair];
Return the point of the curve at position t.
Velocity2d: PROC [spline: Spline2d, t: REAL] RETURNS [Pair];
Return the unnormalized tangent of the curve at position t.
Acceleration2d: PROC [spline: Spline2d, t: REAL] RETURNS [Pair];
Return the unnormalized acceleration of the curve at position t.
END.