Struct Aabb
An axis-aligned bounding box, or AABB for short, is a box aligned with coordinate axes and fully enclosing some object.
Inherited Members
Namespace: Unity.Physics
Syntax
[Serializable]
public struct Aabb
Fields
Empty
Create an empty, invalid AABB.
Declaration
public static readonly Aabb Empty
Field Value
Type | Description |
---|---|
Aabb |
Max
The maximum point.
Declaration
public float3 Max
Field Value
Type | Description |
---|---|
float3 |
Min
The minimum point.
Declaration
public float3 Min
Field Value
Type | Description |
---|---|
float3 |
Properties
Center
Gets the center.
Declaration
public readonly float3 Center { get; }
Property Value
Type | Description |
---|---|
float3 | The center. |
Extents
Gets the extents.
Declaration
public readonly float3 Extents { get; }
Property Value
Type | Description |
---|---|
float3 | The extents. |
IsValid
Gets a value indicating whether this aabb is valid.
Declaration
public readonly bool IsValid { get; }
Property Value
Type | Description |
---|---|
Boolean | True if this aabb is valid, false if not. |
SurfaceArea
Gets the surface area.
Declaration
public readonly float SurfaceArea { get; }
Property Value
Type | Description |
---|---|
Single | The surface area. |
Methods
ClosestPoint(float3)
Returns the closest point on the bounds of the AABB to the specified position.
Declaration
public float3 ClosestPoint(float3 position)
Parameters
Type | Name | Description |
---|---|---|
float3 | position | A target point in space. |
Returns
Type | Description |
---|---|
float3 | The closest point. |
Contains(float3)
Query if this aabb contains the given point.
Declaration
public bool Contains(float3 point)
Parameters
Type | Name | Description |
---|---|---|
float3 | point | The point to test with. |
Returns
Type | Description |
---|---|
Boolean | True if the aabb contains the point, false if not. |
Contains(Aabb)
Query if this aabb contains the given aabb.
Declaration
public bool Contains(Aabb aabb)
Parameters
Type | Name | Description |
---|---|---|
Aabb | aabb | The Aabb to test with. |
Returns
Type | Description |
---|---|
Boolean | True if this aabb contains given aabb, false if not. |
Expand(Single)
Expands the aabb by the provided distance.
Declaration
public void Expand(float distance)
Parameters
Type | Name | Description |
---|---|---|
Single | distance | The distance. |
Include(float3)
Includes the given point in the aabb.
Declaration
public void Include(float3 point)
Parameters
Type | Name | Description |
---|---|---|
float3 | point | The point. |
Include(Aabb)
Includes the given aabb into this aabb.
Declaration
public void Include(Aabb aabb)
Parameters
Type | Name | Description |
---|---|---|
Aabb | aabb | The aabb to include. |
Intersect(Aabb)
Intersects this aabb and another one.
Declaration
public void Intersect(Aabb aabb)
Parameters
Type | Name | Description |
---|---|---|
Aabb | aabb | The aabb to intersect with. |
Overlaps(Aabb)
Query if this aabb overlaps the given other aabb.
Declaration
public bool Overlaps(Aabb other)
Parameters
Type | Name | Description |
---|---|---|
Aabb | other | The other aabb. |
Returns
Type | Description |
---|---|
Boolean | True if there is an overlap, false otherwise. |
Union(Aabb, Aabb)
Create a union of two aabbs.
Declaration
public static Aabb Union(Aabb a, Aabb b)
Parameters
Type | Name | Description |
---|---|---|
Aabb | a | An Aabb to process. |
Aabb | b | An Aabb to process. |
Returns
Type | Description |
---|---|
Aabb | The union of a and b. |