Struct AABB
- Namespace
- ValveResourceFormat.Renderer
- Assembly
- Renderer.dll
Axis-aligned bounding box for spatial queries and culling.
public readonly struct AABB : IEquatable<AABB>Implements
Inherited Members
Constructors
AABB(Vector3, Vector3)
Initializes a new bounding box from minimum and maximum corners.
public AABB(Vector3 min, Vector3 max)Parameters
AABB(Vector3, float)
Initializes a new bounding box centered at a point with uniform extents.
public AABB(Vector3 point, float halfExtents)Parameters
AABB(float, float, float, float, float, float)
Initializes a new bounding box from individual coordinate components.
public AABB(float min_x, float min_y, float min_z, float max_x, float max_y, float max_z)Parameters
Fields
Max
Maximum corner of the bounding box.
public readonly Vector3 MaxField Value
Min
Minimum corner of the bounding box.
public readonly Vector3 MinField Value
Properties
Center
Gets the center point of the bounding box.
public Vector3 Center { get; }Property Value
Size
Gets the size of the bounding box.
public Vector3 Size { get; }Property Value
Methods
Contains(Vector3)
Tests if a point is inside this bounding box.
public bool Contains(Vector3 point)Parameters
pointVector3-
The point to test.
Returns
Contains(in AABB)
Tests if another bounding box is completely inside this one.
public bool Contains(in AABB other)Parameters
otherAABB-
The other bounding box.
Returns
Encapsulate(in Vector3)
Expands this bounding box to include a point.
public AABB Encapsulate(in Vector3 point)Parameters
pointVector3-
The point to include.
Returns
- AABB
-
A new bounding box that contains the original box and the point.
Equals(AABB)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(AABB other)Parameters
otherAABB-
An object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)Parameters
objobject?-
The object to compare with the current instance.
Returns
- bool
-
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()Returns
- int
-
A 32-bit signed integer that is the hash code for this instance.
Intersects(in AABB)
Tests if another bounding box intersects this one.
public bool Intersects(in AABB other)Parameters
otherAABB-
The other bounding box.
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()Returns
- string
-
The fully qualified type name.
Transform(in Matrix4x4)
Transforms this bounding box by a matrix and returns an axis-aligned result.
public AABB Transform(in Matrix4x4 transform)Parameters
transformMatrix4x4-
The transformation matrix.
Returns
- AABB
-
A new axis-aligned bounding box that contains the transformed box.
Remarks
The resulting AABB may be larger than the original if rotation is involved. To minimize error accumulation, premultiply matrices before transforming.
Translate(in Vector3)
Translates this bounding box by an offset.
public AABB Translate(in Vector3 offset)Parameters
offsetVector3-
The translation offset.
Returns
- AABB
-
A new bounding box at the translated position.
Union(in AABB)
Computes the union of this bounding box with another.
public AABB Union(in AABB other)Parameters
otherAABB-
The other bounding box.
Returns
- AABB
-
A new bounding box that contains both boxes.
Operators
operator ==(AABB, AABB)
Checks if two bounding boxes are equal.
public static bool operator ==(AABB left, AABB right)Parameters
Returns
operator !=(AABB, AABB)
Checks if two bounding boxes are not equal.
public static bool operator !=(AABB left, AABB right)