Type of immutable rectangles of floats
Module OgamlMath.FloatRect
Operations on float rectanglesThis module defines the FloatRect 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
Converts an integer rectangle to a float rectangle
Truncates the floating-point coordinates of a rectangle
See : OgamlMath.IntRect
See : OgamlMath.IntRect
intersects t1 t2
returns true
iff t1
and t2
overlap
contains t p
returns true
iff the rectangle t
contains p
includes t r
returns true
iff the rectangle r
is included in the rectangle t
Returns a pretty-printed string (not for serialization)