DIRECTORY Cubic USING [Bezier], Complex USING [VEC], Seq USING [ComplexSequence,JointSequence], FitBasic USING [Handle, JointType]; FitState: CEDAR DEFINITIONS = BEGIN Handle: TYPE = FitBasic.Handle; Create: PROC RETURNS [handle: Handle]; Undo: PROC[handle: Handle]; --reverses the last operation SetClosed: PROC [handle: Handle, closed: BOOLEAN] = INLINE {handle.closed _ closed}; GetClosed: PROC [handle: Handle] RETURNS [BOOLEAN] = INLINE {RETURN[handle.closed]}; SetMinDist: PROC [handle: Handle, minDist: REAL _ 0]= INLINE {handle.minDist _ minDist}; GetMinDist: PROC [handle: Handle] RETURNS [REAL] = INLINE {RETURN[handle.minDist]}; DataType: TYPE = {samples, links, joints, contours}; ResetData: PROC[handle: Handle, type: DataType, all: BOOLEAN _ FALSE]; ScaleData: PROC[handle: Handle, scale: REAL, type: DataType, all: BOOLEAN _ FALSE]; TranslateData: PROC[handle: Handle, trans: Complex.VEC, type: DataType, all: BOOLEAN _ FALSE]; AddSample: PROC[handle: Handle, x,y: REAL, joint: FitBasic.JointType _ none, tanIn,tanOut: Complex.VEC _ [0,0]]; --adds to the end of the current list RemoveSample: PROC[handle: Handle]; --unlinks the selected sample InsertBeforeSample: PROC[handle: Handle, x,y: REAL, joint: FitBasic.JointType _ none, tanIn,tanOut: Complex.VEC _ [0,0]]; --inserts before the selected sample AddLink: PROC[handle: Handle, b: Cubic.Bezier]; SetJoint: PROC[handle: Handle, index: NAT, joint: FitBasic.JointType _ potential, tanIn,tanOut: Complex.VEC _ [0,0]]; NewContour: PROC[handle: Handle]; -- Makes an empty contour and selects it NextContour: PROC[handle: Handle]; -- Moves to the next contour. CurrentJoints: PROC[handle: Handle] RETURNS[joints: Seq.JointSequence, tangents: Seq.ComplexSequence]; CurrentSamples: PROC[handle: Handle] RETURNS[Seq.ComplexSequence]; EnumerateLinks: PROC[handle: Handle, newContour: PROC[x,y: REAL], newCubic: PROC[c: Cubic.Bezier]]; EnumerateSamples: PROC[handle: Handle, newContour: PROC[x,y: REAL], newSample: PROC[x,y: REAL]]; CountContours: PROC[handle: Handle] RETURNS [INT]; END. àFitState.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Maureen Stone November 27, 1984 2:42:38 pm PST Michael Plass August 13, 1982 9:50 am Doug Wyatt, September 5, 1985 1:54:13 pm PDT A contour is a list of samples and a list of cubic links. The cubic links are usually the result of the last fitting operation. The handle keeps a list of contours with one marked as "current". Operations that apply to one contour act on the current contour. The current sample list keeps a reference to a selected sample. Operations that take a sample use the current sample. The selected is initialized to the list head. InsertBefore the list head adds the sample to the end of the list. AddSample and InsertBeforeSample change the selected sample to be the last sample added. contours = samples plus links. Joints is a subset of samples. The all flag defines whether the operation is applied only to the current contour or to all contours in the handle. JointType: TYPE = {none, potential, forced}; Links are not edited (yet) so only AddLink and Reset are necessary This sets a flag. No allocation necessary. tanIn=tanOut for smooth joint Change the definition of current contour For the interface PiecewiseFit Samples are a sequence of points. Closed indicates a closed shape (don't double endpoints) The joints indicate the possible locations for joints in the curve and are a sequence of the record [index: NAT, forced: BOOLEAN]. The index is an index into the sample sequence so, for example, samples[joints[0].index] is the sample value for the first possible joint in the curve. If forced=TRUE a joint will always occure at that point. points and links independent of structures. See FitStateUtils for other enumerators ÊÒ˜codešœ ™ Kšœ Ïmœ1™