AABB
consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
It uses floating-point coordinates. The 2D counterpart to AABB
is .
Note: Unlike Rect2, AABB
does not have a variant that uses integer coordinates.
Tutorials
Methods
- Vector3 end
Ending corner. This is calculated as position + size
. Setting this value will change the size.
- position
Beginning corner. Typically has values lower than end.
Size from to end. Typically all components are positive.
If the size is negative, you can use to fix it.
Method Descriptions
Constructs an AABB
from a position and size.
- abs ( )
Returns an AABB with equivalent position and size, modified so that the most-negative corner is the origin and the size is positive.
- bool encloses ( with )
- AABB expand ( to_point )
Returns this AABB
expanded to include a given point.
- float get_area ( )
Returns the volume of the AABB
.
- get_endpoint ( int idx )
Gets the position of the 8 endpoints of the in space.
- get_longest_axis ( )
Returns the normalized longest axis of the AABB
.
- int get_longest_axis_index ( )
Returns the index of the longest axis of the AABB
(according to ‘s AXIS_*
constants).
- float get_longest_axis_size ( )
Returns the scalar length of the longest axis of the AABB
.
- get_shortest_axis ( )
Returns the normalized shortest axis of the AABB
.
- int get_shortest_axis_index ( )
Returns the index of the shortest axis of the AABB
(according to ::AXIS* enum).
Returns the scalar length of the shortest axis of the AABB
.
- Vector3 get_support ( dir )
- AABB grow ( by )
Returns a copy of the AABB
grown a given amount of units towards all the sides.
- bool has_no_area ( )
Returns true
if the AABB
is flat or empty.
- has_no_surface ( )
Returns true
if the AABB
is empty.
- bool has_point ( point )
Returns true
if the AABB
contains a point.
- AABB intersection ( with )
Returns the intersection between two . An empty AABB (size 0,0,0) is returned on failure.
- bool intersects ( with )
Returns true
if the AABB
overlaps with another.
- bool intersects_plane ( plane )
Returns true
if the AABB
is on both sides of a plane.
Returns true
if the AABB
intersects the line segment between from
and to
.
- is_equal_approx ( AABB aabb )
Returns true
if this AABB
and aabb
are approximately equal, by calling on each component.
- AABB merge ( with )