Struct AABB
An AABB, or axis-aligned bounding box, is a simple bounding shape, typically used for quick determination of whether two objects may intersect. If the AABBs that enclose each object do not intersect, then logically the objects also may not intersect. This AABB struct is formulated as a center and a size, rather than as a minimum and maximum coordinate. Therefore, there may be issues at extreme coordinates, such as FLT_MAX or infinity.
Namespace: Unity.Mathematics
Assembly: Unity.Mathematics.Extensions.dll
Syntax
[Serializable]
public struct AABB
Fields
Name | Description |
---|---|
Center | The location of the center of the AABB |
Extents | A 3D vector from the center of the AABB, to the corner of the AABB with maximum XYZ values |
Properties
Name | Description |
---|---|
Max | The maximum coordinate of the AABB |
Min | The minimum coordinate of the AABB |
Size | The size of the AABB |
Methods
Name | Description |
---|---|
Contains(AABB) | Returns whether the AABB contains another AABB completely. Because math is done to compute the minimum and maximum coordinates of the AABBs, overflow is possible for extreme values. |
Contains(float3) | Returns whether a point in 3D space is contained by the AABB, or not. Because math is done to compute the minimum and maximum coordinates of the AABB, overflow is possible for extreme values. |
DistanceSq(float3) | Determines the squared distance from a point to the nearest point to it that is contained by an AABB. |
ToString() | Returns a string representation of the AABB. |
Transform(float4x4, AABB) | Transforms an AABB by a 4x4 transformation matrix, and returns a new AABB that contains the transformed AABB completely. |