# Rectangles

Provides a Rect structure that helps with operations on rectangles.

## API

Fields:

x
y
width
height

:new ( x y width height -- rect )
  Allocate a new rectangle with specified values.

:tmpnew ( x y width height -- rect )
  Allocate new rectangle in system scratchpad.

:topleft ( self -- x y )
  Top-left point of the rectangle.

:bottomright ( self -- x y )
  Bottom-right point of the rectangle.

:= ( other self -- f )
  Whether the rectangle has the same field values as "other".

:null? ( self -- f )
  Whether the rectangle has a 0 width or height.

:haspoint? ( x y self -- f )
  Whether coordinates "x,y" are inside the rectangle.

:hasrect? ( other self -- f )
  Wether rectangle "other" is entirely contained (can be equal) in rectangle
  "self".

:intersects? ( other self -- f )
  Whether one part of "other" intersects with "self" (can be contained).

:intersection ( other self -- rect )
  Yields a rectangle (created with :tmpnew) that represents the intersection of
  "other" and "self". If there is no intersection, will yield a null rectangle.

:copy ( other self -- )
  Copy values in all fields of "other" into "self".

:move ( x y self -- )
  Move "self"'s top-left point to "x,y".

:resize ( width height self -- )
  Resize "self" to "width,height".

:print ( self -- )
  Print a human readable representation of "self".
