-- Cubic.mesa
-- Last changed by Doug Wyatt, September 1, 1980 10:00 PM

DIRECTORY
Vector USING [Vec];

Cubic: DEFINITIONS = {

Coeffs: TYPE = RECORD[c0,c1,c2,c3: Vector.Vec];
-- The coefficients for a parametric cubic
-- x = c3.x*t↑3 + c2.x*t↑2 + c1.x*t + c0.x
-- y = c3.y*t↑3 + c2.y*t↑2 + c1.y*t + c0.y

Bezier: TYPE = RECORD[b0,b1,b2,b3: Vector.Vec];
-- The Bezier control points for a cubic

CoeffsToBezier: PROCEDURE[c: Coeffs] RETURNS[b: Bezier] = INLINE {
CCoeffsToBezier[@c,@b]; RETURN[b]
};
BezierToCoeffs: PROCEDURE[b: Bezier] RETURNS[c: Coeffs] = INLINE {
CBezierToCoeffs[@b,@c]; RETURN[c]
};
BezierPolygon: PROCEDURE[b: Bezier, epsilon: REAL,
Proc: PROCEDURE[Vector.Vec]] = INLINE {
CBezierPolygon[@b,epsilon,Proc]
};

CCoeffsToBezier: PRIVATE PROCEDURE[c: POINTER TO Coeffs,
b: POINTER TO Bezier];
CBezierToCoeffs: PRIVATE PROCEDURE[b: POINTER TO Bezier,
c: POINTER TO Coeffs];
CBezierRelax: PUBLIC PROCEDURE[b: POINTER TO Bezier, costheta: REAL,
Proc: PROCEDURE[Bezier]];
CBezierPolygon: PRIVATE PROCEDURE[b: POINTER TO Bezier, epsilon: REAL,
Proc: PROCEDURE[Vector.Vec]];
SetEpsilon:PROCEDURE[e:REAL];

CubicImpl: PROGRAM;

}.