-- Curve.mesa
-- Maureen Stone July 17, 1982 10:21 am
-- Michael Plass  August 13, 1982 9:50 am
DIRECTORY
	Cubic USING [Bezier],
	Complex USING [Vec],
	Seq USING [ComplexSequence,NatSequence],
	IO USING [Handle];

Curve: DEFINITIONS =
BEGIN

Handle: TYPE = REF Rec;
Rec: TYPE;

Create: PUBLIC PROC RETURNS [handle: Handle];
Visible: PUBLIC PROC [handle: Handle, visible: BOOLEAN ← TRUE] RETURNS [was: BOOLEAN];

defaultHandle: Handle;

ResetSamples: PUBLIC PROC[handle: Handle];
AddSample: PUBLIC PROC[handle: Handle, x,y: REAL];
StartSamples: PUBLIC PROC[handle: Handle, x,y: REAL];

ResetContours: PUBLIC PROC[handle: Handle]; -- yields one empty sample set
CountContours: PUBLIC PROC[handle: Handle] RETURNS [INT];
AddContour: PUBLIC PROC[handle: Handle]; -- Makes a new sample set and selects it
NextContour: PUBLIC PROC[handle: Handle]; -- Moves to the next contour.

ResetLinks: PUBLIC PROC[handle: Handle];
AddLink: PUBLIC PROC[handle: Handle, b: Cubic.Bezier];

ResetNodes: PUBLIC PROC[handle: Handle];
AddNode: PUBLIC PROC[handle: Handle, index: NAT, tan: Complex.Vec ← [0,0]];
DeleteNode: PUBLIC PROC[handle: Handle, index: NAT];

ResetCusps: PUBLIC PROC[handle: Handle];
AddCusp: PUBLIC PROC[handle: Handle, index: NAT, tanIn,tanOut: Complex.Vec ← [0,0]];
DeleteCusp: PUBLIC PROC[handle: Handle, index: NAT];

CurrentNodes: PUBLIC PROC[handle: Handle] RETURNS[nodes: Seq.NatSequence, tangents: Seq.ComplexSequence];

CurrentSamples: PUBLIC PROC[handle: Handle] RETURNS[Seq.ComplexSequence];

CurrentCusps: PUBLIC PROC[handle: Handle] RETURNS[cusps: Seq.NatSequence, tangents: Seq.ComplexSequence];

DrawLine: PUBLIC PROC[from, to: Complex.Vec];
TTY: PUBLIC PROC RETURNS[IO.Handle];
 
END.