Type of immutable rectangles of integers
Module OgamlMath.IntRect
Operations on integer rectanglesThis module defines the IntRect type and various operations on it.
create position size
creates a rectangle at position position
and of size size
create_from_points p1 p2
creates a rectangle going from p1
to p2
Zero rectangle
Unit rectangle
Returns the position of a rectangle
Returns the absolute position of a rectangle, that is the point of minimal coordinates
Returns the top corner (aka position + size) of a rectangle
Returns the absolute corner of a rectangle, that is the point of maximal coordinates
Returns the size of a rectangle
Returns the absolute size of a rectangle
Returns the center of a rectangle
normalize rect
returns a rectangle equivalent to rect
but with positive size
Returns the area of a rectangle
Scales a rectangle
Adds a vector to the height and width of a rectangle. Be careful since if the rectangle is not normalized, adding a positive vector may reduce the effective size of the rectangle.
Translates a rectangle
intersects t1 t2
returns true
iff t1
and t2
overlap
includes t r
returns true
iff the rectangle r
is included in the rectangle t
contains t p
returns true
iff the rectangle t
contains p
if
strict
is set to true
then upper bounds are not included (false
by default)
iter t f
iterates through all points of the rectangle t
if
strict
is set to false
then upper bounds are included (true
by default)
fold t f u
folds through all points of the rectangle t
if
strict
is set to false
then upper bounds are included (true
by default)
Returns a pretty-printed string (not for serialization)