Rectangles
Factor handbook » UI framework » Building user interfaces » Gadget geometry

Next:relative-loc ( fromgadget togadget -- loc )


The math.rectangles vocabulary defines a rectangle data type and operations on them.
rect


Rectangles can be taken apart:
rect-bounds ( rect -- loc dim )

rect-extent ( rect -- loc ext )


New rectangles can be created:
<zero-rect> ( -- rect )

<rect> ( loc dim -- rect )

<extent-rect> ( loc ext -- rect )


Set-theoretic operations on rectangles:
rect-intersect ( rect1 rect2 -- newrect )

rect-union ( rect1 rect2 -- newrect )

contains-rect? ( rect1 rect2 -- ? )

contains-point? ( point rect -- ? )


A utility word:
offset-rect ( rect loc -- newrect )