Rect2
2D Axis-aligned bounding box.
Properties
Rect2 ( position, Vector2 size ) | |
Rect2 ( x, float y, width, float height ) | |
abs ( ) | |
clip ( b ) | |
bool | ( Rect2 b ) |
expand ( to ) | |
float | ( ) |
Rect2 | ( float by ) |
grow_individual ( left, float top, right, float bottom ) | |
grow_margin ( margin, float by ) | |
has_no_area ( ) | |
has_point ( point ) | |
bool | ( Rect2 b ) |
merge ( b ) |
Description
Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
Property Descriptions
- Vector2 end
Ending corner.
- position
Position (starting corner).
- Vector2 size
Size from position to end.
- Rect2 ( Vector2 position, size )
Constructs a Rect2
by x, y, width, and height.
- abs ( )
Returns a Rect2
with equivalent position and area, modified so that the top-left corner is the origin and width
and height
are positive.
- Rect2 clip ( b )
Returns the intersection of this Rect2
and b.
Returns if this Rect2
completely encloses another one.
- Rect2 expand ( to )
Returns this Rect2
expanded to include a given point.
- float get_area ( )
- grow ( float by )
Returns a copy of the Rect2
grown a given amount of units towards all the sides.
Returns a copy of the Rect2
grown a given amount of units towards each direction individually.
Returns a copy of the grown a given amount of units towards the direction.
- bool has_no_area ( )
Returns true
if the Rect2
is flat or empty.
- has_point ( Vector2 point )
Returns true
if the Rect2
contains a point.
- merge ( Rect2 b )
Returns a larger Rect2 that contains this Rect2 and b
.