SF.mesa
Copyright Ó 1986, 1987, 1988, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, February 10, 1988 9:39:07 am PST
Doug Wyatt, January 19, 1987 8:47:07 pm PST
Integer-coordinate vector and box representations and operations.
See the SFInline interface for INLINE versions of these
Vec operations
Vec: TYPE ~ RECORD [s, f: INTEGER];
minVec: Vec ~ [s: INTEGER.FIRST, f: INTEGER.FIRST];
maxVec: Vec ~ [s: INTEGER.LAST, f: INTEGER.LAST];
zeroVec: Vec ~ [s: 0, f: 0];
NonNegative:
PROC [v: Vec]
RETURNS [Vec];
Neg:
PROC [v: Vec]
RETURNS [Vec];
Add:
PROC [v1, v2: Vec]
RETURNS [Vec];
Sub:
PROC [v1, v2: Vec]
RETURNS [Vec];
Min:
PROC [v1, v2: Vec]
RETURNS [Vec];
Componentwise MIN
Min3:
PROC [v1, v2, v3: Vec]
RETURNS [Vec];
Max:
PROC [v1, v2: Vec]
RETURNS [Vec];
Max3:
PROC [v1, v2, v3: Vec]
RETURNS [Vec];
Componentwise MAX
Eq: PROC [v1, v2: Vec] RETURNS [BOOL];
Box operations
Box:
TYPE ~
RECORD [min, max: Vec ¬ zeroVec];
b: Box denotes all v: Vec that satisfy v.s IN[b.min.s..b.max.s) AND v.f IN[b.min.f..b.max.f)
maxBox: Box ~ [min: minVec, max: maxVec];
BoxAction:
TYPE ~
PROC [box: Box];
BoxGenerator:
TYPE ~
PROC [boxAction: BoxAction];
Nonempty:
PROC [box: Box]
RETURNS [
BOOL];
box is nonempty iff box.min is componentwise strictly less than box.max
Empty:
PROC [box: Box]
RETURNS [
BOOL];
Intersect:
PROC [box1, box2: Box]
RETURNS [Box];
Disjoint:
PROC [box1, box2: Box]
RETURNS [
BOOL];
SizeF:
PROC [box: Box]
RETURNS [
CARDINAL];
SizeS:
PROC [box: Box]
RETURNS [
CARDINAL];
Size:
PROC [box: Box]
RETURNS [Vec];
Displace:
PROC [box: Box, t: Vec]
RETURNS [Box];
Inside:
PROC [inner, outer: Box]
RETURNS [
BOOL];
In:
PROC [vec: Vec, box: Box]
RETURNS [
BOOL];