<> <> <> <> <> <> <> <<>> DIRECTORY Complex USING [VEC], Cubic2 USING [Bezier], Seq USING [ComplexSequence, RealSequence]; LSPiece: CEDAR DEFINITIONS = BEGIN OPEN Seq; Metrics: TYPE = REF MetricsRec; MetricsRec: TYPE = RECORD [ maxItr: INT ¬ 10, -- 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: Cubic2.Bezier, err: REAL, iterations: INT, maxDev: REAL, indexOfMaxDev: NAT]; <<>> <= maxit.>> <<>> RealSample: TYPE = REF RealSampleObj; RealSampleObj: TYPE = RECORD [real: SEQUENCE len: NAT OF BOOLEAN]; FitPiece2: PROC [ z: ComplexSequence, t: RealSequence ¬ NIL, metrics: Metrics, from, thru: NAT, -- fit points in range [from..thru] modulo z.length initFree, finalFree: BOOL ¬ FALSE, initTangent, finalTangent: Complex.VEC ¬ [0,0], useOldTValues: BOOL ¬ FALSE, someInterp: BOOL ¬ FALSE, realSample: RealSample ¬ NIL] RETURNS [b: Cubic2.Bezier, err: REAL, iterations: INT, maxDev: REAL, indexOfMaxDev: NAT]; <> ComputeCurvature: PROC [farCP, nearCP, joint: Complex.VEC, jointFirst: BOOL] RETURNS [REAL]; CurvatureAtPt: PROC [bezier: Cubic2.Bezier, pt: Complex.VEC] RETURNS [REAL]; END.