INTERFACE PZIntChain; (* Sequences (possibly periodic) of points of the integer grid. *) (* Last edited on 2001-11-15 17:11:48 by stolfi *) IMPORT Rd, Wr, PZSegment; FROM PZTypes IMPORT INT, NAT; TYPE Point = ARRAY [0..1] OF INT; T = ARRAY OF Point; (* The "DoXXX" procedures below are analogous to the "XXX" procedures, except that the result is returned in an array provided by the client (which must have the correct size). *) PROCEDURE Trim(READONLY c: T; start, length: NAT): REF T; PROCEDURE DoTrim(READONLY c: T; start, length: NAT; VAR x: T); (* Returns a new chain that is a copy of elements from "c[start]" to "c[start+length-1]". Assumes the chain is periodic, i.e. "c[i+n]=c[i]" for all "i", where "n=NUMBER(c)". *) PROCEDURE Reverse(VAR c: T); (* Reverses the chain "c" back-to-front. *) PROCEDURE ExtractSegment(READONLY c: T; s: PZSegment.T): REF T; PROCEDURE DoExtractSegment(READONLY c: T; s: PZSegment.T; VAR x: T); (* Extracts the given segment from the curvature graph "c", assumed to be closed. If "s.rev" is TRUE, also reverses it. *) TYPE ReadData = RECORD cmt: TEXT; c: REF T END; PROCEDURE Write(wr: Wr.T; cmt: TEXT; READONLY c: T); PROCEDURE Read(rd: Rd.T): ReadData; END PZIntChain. (* Copyright © 2001 Universidade Estadual de Campinas (UNICAMP). Authors: Helena C. G. Leitão and Jorge Stolfi. This file can be freely distributed, used, and modified, provided that this copyright and authorship notice is preserved, and that any modified versions are clearly marked as such. This software has NO WARRANTY of correctness or applicability for any purpose. Neither the authors nor their employers chall be held responsible for any losses or damages that may result from its use. *)