Last edited by: David Kurlander - September 6, 1987 5:59:18 pm PDT
Bier, September 4, 1987 11:20:22 pm PDT
DIRECTORY
GGBasicTypes, GGModelTypes, GGSegmentTypes, ImagerTransformation, MatchViewer;
MatchTurtle:
CEDAR
DEFINITIONS
IMPORTS MatchViewer
= BEGIN
Point: TYPE = GGBasicTypes.Point;
Segment: TYPE = GGSegmentTypes.Segment;
Slice: TYPE = GGModelTypes.Slice;
Traj: TYPE = GGModelTypes.Traj;
Type Definitions
TurtleInfo: TYPE = REF TurtleInfoObj;
TurtleInfoObj:
TYPE =
RECORD [
length: REAL,
start: Point, -- start and end used during construction
end: Point
];
TurtleHeader: TYPE = REF TurtleHeaderObj;
TurtleHeaderObj:
TYPE =
RECORD [
length: REAL,
center: Point, -- center of mass of curve (assuming a uniform wire density)
closed: BOOL,
radius: REAL, -- really the max distance from the curve to the center of mass
tform: ImagerTransformation.Transformation ← NIL,
originalStart: Point,
originalCenter: Point,
tail: LIST OF TurtleInfo
];
Matcher: TYPE = REF MatcherObj;
MatcherObj:
TYPE =
RECORD [
turtle1, turtle2: TurtleHeader ← NIL,
maxError: REAL ← 0.0,
noMatch: BOOL ← TRUE,
checkFirst: BOOL ← TRUE,
checkSecond: BOOL ← FALSE,
turtleCopy: TurtleHeader ← NIL,
tailSoFar: LIST OF TurtleInfo ← NIL
];
PositionDescriptor: TYPE = REF PositionDObj;
PositionDObj:
TYPE =
RECORD [
valid: BOOL ← FALSE, -- specifies whether tform1 and tform2 are to be taken seriously
settable: BOOL ← TRUE, -- specifies whether tform1 and tform2 can be set
tform1, tform2: ImagerTransformation.Transformation ← NIL,
others: Matcher ← NIL -- a generator for other position descriptors which may match
];
Making Turtles
GetShapeOfSlice: PROC [slice: Slice] RETURNS [TurtleHeader];
TrajToTurtle: PROC [traj: Traj] RETURNS [turtle: TurtleHeader];
SegmentToTurtle: PROC [seg: Segment, soFar: LIST OF TurtleInfo, reverse: BOOL ← FALSE] RETURNS [path: LIST OF TurtleInfo];
CopyTurtleTail: PROC [turtleTail: LIST OF TurtleInfo] RETURNS [newTail: LIST OF TurtleInfo ← NIL];
PackageTurtleTail:
PROC [tail:
LIST
OF TurtleInfo]
RETURNS [turtle: TurtleHeader];
Public for making turtles on the fly (for efficiency). Also used internally.
Modifying Turtles
FlipTurtle: PROC [turtle: TurtleHeader] RETURNS [newTurtle: TurtleHeader];
Comparing Turtles
TurtleEqual: PROC [turtle1, turtle2: TurtleHeader, tol: REAL ← MatchViewer.GetMatchTolerance[], posD: PositionDescriptor ← NIL] RETURNS [BOOL ← FALSE];
TurtleEqualEitherWay: PROC [turtle1, turtle2: TurtleHeader, tol: REAL ← MatchViewer.GetMatchTolerance[], posD: PositionDescriptor ← NIL] RETURNS [BOOL];
CreateMatcher:
PROC [turtle1, turtle2: TurtleHeader, tol:
REAL ← -1.0, oneWay:
BOOL]
RETURNS [m: Matcher];
Makes a generator of the orientations which match turtle1 to turtle2.
NextMatch: PROC [m: Matcher] RETURNS [PositionDescriptor ← NIL];
END.