INTERFACEAJunoRect ;
JunoRect.T
represents a rectangle in Juno coordinates. As opposed to
Trestle's Rect.T
, Juno rectangles are real-valued, and their
y-coordinates increase to the north. The point (x, y)
is in the rectangle
r
if and only if:
r.west <= x < r.east r.south <= y < r.northAlthough
JunoRect.T
's use half-open intervals just like Trestle's
Rect.T
's, the fact that they are over the real numbers makes the
distinction less important.
IMPORT JunoValue, RTVal, JunoPt; TYPE T = RECORD west, east, north, south: JunoValue.Real END; CONST Empty = T{0.0, 0.0, 0.0, 0.0}; PROCEDURE Scale(READONLY r: T; s: JunoValue.Real): T;
Return the rectangle produced by scalingr
about the origin by the scale factors
.
PROCEDURE Rotate90(READONLY r: T): T;
Return the rectangle produced by rotating r
90 degrees about the
origin.
PROCEDURE Add(READONLY r: T; READONLY p: JunoPt.T): T;
Return the rectangle produced by translating the rectangler
by the vectorp
.
PROCEDURE Join(READONLY r1, r2: T): T;
Return the smallest rectangle enclosing bothr1
andr2
.
PROCEDURE ToRTVal(READONLY r: T): RTVal.T;
Return the Juno-valued representation ofr
, that is a pair of points(sw, ne)
wheresw
is the pair(r.west, r.south)
andne
is the pair(r.east, r.north)
.
END JunoRect.