Rect2

Category: Built-In Types

Brief Description

2D Axis-aligned bounding box.

Properties

Vector2end
Vector2position
Vector2size

Methods

Rect2Rect2 ( Vector2 position, Vector2 size )
Rect2Rect2 ( float x, float y, float width, float height )
Rect2abs ( )
Rect2clip ( Rect2 b )
boolencloses ( Rect2 b )
Rect2expand ( Vector2 to )
floatget_area ( )
Rect2grow ( float by )
Rect2grow_individual ( float left, float top, float right, float bottom )
Rect2grow_margin ( int margin, float by )
boolhas_no_area ( )
boolhas_point ( Vector2 point )
boolintersects ( Rect2 b )
Rect2merge ( Rect2 b )

Description

Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.

Tutorials

Property Descriptions

Ending corner.


Position (starting corner).


Size from position to end.

Method Descriptions

Constructs a Rect2 by position and size.


Constructs a Rect2 by x, y, width, and height.


Returns a Rect2 with equivalent position and area, modified so that the top-left corner is the origin and width and height are positive.


Returns the intersection of this Rect2 and b.


Returns true if this Rect2 completely encloses another one.


Returns this Rect2 expanded to include a given point.


Returns the area of the Rect2.


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 Rect2 grown a given amount of units towards the Margin direction.


  • bool has_no_area ( )

Returns true if the Rect2 is flat or empty.


Returns true if the Rect2 contains a point.


Returns true if the Rect2 overlaps with another.


Returns a larger Rect2 that contains this Rect2 and b.