<> <> <> <> <> <> <<>> DIRECTORY Complex USING [VEC], Cubic USING [Bezier], Seq USING [ComplexSequence, RealSequence]; LSPiece: CEDAR DEFINITIONS = BEGIN OPEN Seq; Metrics: TYPE = REF MetricsRec; MetricsRec: TYPE = RECORD [ maxItr: INT _ 500, -- limit on number of iterations maxDev: REAL _ .00001, --stop iterating if the maximum deviation gets below this amount sumErr: REAL _ .00001, -- stop iterating if the sum of squares gets below this amount deltaT: REAL _ 0.000005 -- stop when the t values each change by less than this ]; FitPiece: PROCEDURE [ z: ComplexSequence, t: RealSequence _ NIL, metrics: Metrics, from, thru: NAT, -- fit points in range [from..thru] modulo z.length initFree, finalFree: BOOLEAN _ FALSE, initTangent, finalTangent: Complex.VEC _ [0,0], useOldTValues: BOOLEAN _ FALSE] RETURNS [b: Cubic.Bezier, err: REAL, iterations: INT, maxDev: REAL]; <<>> <= maxit.>> END.