JunoImage.mesa
Last Hacked by: Jorge Stolfi June 13, 1984 9:00:35 am PDT
Procedures to manipulate and traverse the current Juno image.
DIRECTORY
JunoStorage USING [Point, Coords, Item, IntCoords],
JunoOldSolver USING [Outcome];
- - - - IMPORTED TYPES
Point: TYPE = Stor.Point;
Coords: TYPE = Stor.Coords;
IntCoords: TYPE = Stor.IntCoords;
Item: TYPE = Stor.Item;
- - - - THE CURRENT IMAGE
The current image consists of a list of points, and a list of constraints and a list of actions involving those points.
PurgeImage:
PROC;
Discards and reclaims all points, actions and constraints in the current image
- - - - ELEMENT ENUMERATION
EnumPoints:
PROC [Proc: PointVisitProc];
Calls Proc for all point on the image.
Proc should not insert or delete points.
PointVisitProc: TYPE = PROC [p: Point];
ReplacePoints:
PROC [Proc: PointReplaceProc];
Replaces p by Proc[p] for each point in image.
If Proc[p] = NIL, deletes and reclaims point.
Proc should not change the other constraint/action arguments.
PointReplaceProc: TYPE = PROC [p: Point] RETURNS [new: Point];
EnumItems:
PROC [Proc: ItemVisitProc];
Calls Proc for each constraint/action on the image.
Proc should not insert or delete constraints/actions.
ItemVisitProc: TYPE = PROC [item: Item];
EnumItemPoints:
PROC [item: Item, Proc: PointVisitProc];
CAlls Proc[p] for each point in arguments of the item.
Proc should not change the constraint/action arguments.
ReplaceItemPoints:
PROC [item: Item, Proc: PointReplaceProc];
Replaces p by Proc[p] for each point in arguments of the item.
Proc should not return NIL.
Proc should not change the other constraint/action arguments.
- - - - BALOON SELECTION
BaloonSelect:
PROC [start: IntCoords, NextPoint: NextPointProc];
The effect of BaloonSelect is to collect the vertices of a polygon (starting with xS, yS and continuing as specified by the NextPoint procedure), and set the wn (winding number) field for all image points contained in the polygon.
The NextPoint procedure should return lastPoint = TRUE if coords is the last point. (BaloonSelect will close the polygon automatically)
NextPointProc: TYPE = PROC RETURNS [coords: IntCoords, lastPoint: BOOL];
AnyWoundPoints:
PROC
RETURNS [
BOOL];
Returns TRUE if there are any points in the image with nonzero winding number.
ItemIsWound:
PROC [item: Item]
RETURNS [wound:
BOOL];
Returns TRUE if all points entering into the item have wn # 0.
UnwindAllPoints:
PROC;
Sets p.wn=0 for all points p in the image.