ImagerManhattan.mesa
Copyright Ó 1984, 1985, 1986, 1987, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, August 2, 1989 12:42:07 pm PDT
Doug Wyatt, February 27, 1986 10:21:30 am PST
Provides operations on manhattan polygons.
The coordinates are given in terms of s and f (for slow and fast).
Modifying existing Polygons
Shift:
PROC [polygon: Polygon, sShift, fShift:
INTEGER];
Canonicalize:
PROC [list:
LIST
OF Box]
RETURNS [Polygon];
Turns a list of arbitrary rectangles into a valid Polygon.
Re-uses the storage, so copy first if list might be shared.
Extracting info from Polygons
BoundingBox:
PROC [polygon: Polygon]
RETURNS [Box];
CountBoxes:
PROC [polygon: Polygon]
RETURNS [
INT];
CountRuns:
PROC [polygon: Polygon]
RETURNS [
INT];
Map:
PROC [polygon: Polygon, boxAction: BoxAction, runs:
BOOL ¬
FALSE];
Clip:
PROC [polygon: Polygon, box: Box, boxAction: BoxAction, runs:
BOOL ¬
FALSE];
Equal:
PROC [a, b: Polygon]
RETURNS [
BOOL];
Visibility:
TYPE ~ {visible, partlyVisible, invisible};
IsVisible:
PROC [mask, clipper: Polygon]
RETURNS [Visibility];
SELECT Intersection[mask, clipper] FROM
= empty => invisible,
= mask => visible,
ENDCASE => partlyVisible;
N. B. will return invisible if mask is empty.
ClipBoxToMask: PROC [box: SF.Box, mask: Polygon, action: SF.BoxAction];
Modifying existing Polygons
DestructiveUnion:
PROC [a, b: Polygon]
RETURNS [Polygon];
Recycles storage of a, does not modify b.
DestructiveIntersection:
PROC [a, b: Polygon]
RETURNS [Polygon];
Recycles storage of a, does not modify b.
DestructiveClip:
PROC [a: Polygon, b: Box]
RETURNS [Polygon];
Recycles storage of a.
DestructiveDifference:
PROC [a, b: Polygon]
RETURNS [Polygon];
Recycles storage of a, does not modify b.