-- DynFit.mesa
-- Last edited by Maureen Stone 28-Oct-81 15:03:01
-- Last edited by Michael Plass 28-Jan-82 12:07:36
-- Michael Plass 30-Sep-81

DIRECTORY
  CurveDefs USING [SampleHandle],
  Vector,
  Complex,
  Seq;

DynFit: DEFINITIONS IMPORTS CurveDefs, Complex =
BEGIN OPEN Seq;
PointNumber: TYPE = NAT;
Patch: TYPE = RECORD[c0,c1,c2,c3: REAL ← 0];
PatchSequence: TYPE = REF PatchSequenceRec;
PatchSequenceRec: TYPE = RECORD[element: SEQUENCE length:NAT OF Patch];


CountSamples: PROCEDURE [s: CurveDefs.SampleHandle] RETURNS [NAT];

SamplesToZ: PROCEDURE [s: CurveDefs.SampleHandle] RETURNS [z: ComplexSequence];

NearestZ: PUBLIC PROCEDURE [z: ComplexSequence, v:Complex.Vec] RETURNS [PointNumber];

Line: TYPE = RECORD [centerOfMass, direction: Complex.Vec];

BestLine: PROCEDURE [z: ComplexSequence, firstPoint, lastPoint: PointNumber]
	    RETURNS [r: Line];

Segments: TYPE = REF SegmentSequenceRec;
SegmentSequenceRec: TYPE = RECORD[endpoint: SEQUENCE length:NAT OF PointNumber];

FitSegments: PROCEDURE [z: ComplexSequence, tolerance: REAL] 
		RETURNS [segments: DynFit.Segments, totalBadness: REAL];

SampleSegments: PROCEDURE [segments: DynFit.Segments, z: ComplexSequence]
    RETURNS [newSamples: ComplexSequence, len: NAT];

END.