-- CGOutlines.mesa
-- Written by Doug Wyatt,  Nov-81  9:35:18
-- Last Modified by J Warnock June 28, 1982 9:04 am

DIRECTORY
  CGCubic USING [Bezier],
  GraphicsBasic USING [Vec];

CGOutlines: DEFINITIONS = {
OPEN GraphicsBasic,CGCubic;

Ref: TYPE = REF Rep;

Rep: TYPE = RECORD[
  size: NAT, -- current size
  data: Data, -- the list of nodes
  fpi: NAT, -- index of first point of current trajectory
  fp:Vec,  -- first point of traj.
  lp:Vec, --last position of current trajectory
  sum:REAL -- sum of arc lengths to current position
  ];

Data: TYPE = REF DataRep;
DataRep: TYPE = RECORD[SEQUENCE space: NAT OF Node];

	
Node: TYPE = REF NodeRep;
NodeRep:TYPE=RECORD[line:BOOLEAN,a1,a2,l1,l2:REAL,bz:Bezier];

Error: ERROR[type: ErrorType];
ErrorType: TYPE = {
  wrongSequence, -- an operation was called in the wrong sequence
  bug  -- an internal consistency check failed
  };

New: PROC[size: NAT ← 0] RETURNS[Ref];
-- create a new path object with given initial size

Reset: PROC[self: Ref] = INLINE { self.size ← 0 };
-- empty the path

MoveTo: PROC[self: Ref, p: Vec] ;

LineTo: PROC[self: Ref, p: Vec];

CurveTo: PROC[self: Ref, b1,b2,b3: Vec];

Close: PROC[self: Ref];

GetMappedVec:PROC[self:Ref,v:Vec] RETURNS [Vec];

GetLinkCount:PUBLIC PROC[self:Ref] RETURNS [c:NAT];

GetLinkLength:PUBLIC PROC[self:Ref,i:NAT] RETURNS [l:REAL];

Copy: PROC[self: Ref] RETURNS[Ref];
-- make a copy of the path

Assign: PROC[self: Ref, copy: Ref];
-- restore the path from another path

}.