AxisAlignedBox
Summary
Represents an axis-aligned bounding box (AABB) 3D space defined by minimum and maximum extents.
Definition
Namespace: SDT4.Managed.Core.Math
Assembly: SDT4.Managed.Core.dll
struct AxisAlignedBox
Implements:
IEquatable<AxisAlignedBox>
Fields
| Name | Type | Description |
|---|---|---|
public Min |
Vector3f | The minimum corner point of the bounding box. |
public Max |
Vector3f | The maximum corner point of the bounding box. |
Properties
| Name | Type | Description |
|---|---|---|
public static get; Infinite |
AxisAlignedBox | Gets an infinite bounding box where minimum bounds exceed maximum bounds. |
public get; set; Extent |
Vector3f | Gets or sets the total size across all dimensions ( |
public get; set; Position |
Vector3f | Gets or sets the centre position of the bounding box. |
public get; HalfExtent |
Vector3f | Gets the half-extents of the bounding box ( |
public get; IsValid |
Boolean | Gets a value indicating whether the bounding box is valid, meaning all components of AxisAlignedBox.Min are less than or equal to AxisAlignedBox.Max. |
Extent Remarks
Modifying the extent scales the box symmetrically around its current centre position.
Position Remarks
Modifying the position translates the box while preserving its current dimensions.
Methods
public Boolean Intersects(AxisAlignedBox other)
Summary: Determines whether this bounding box intersects another bounding box.
Parameters:
other(AxisAlignedBox): The other bounding box to test against.
Returns:
- Boolean:
if the boxes overlap or touch; otherwise, .
public Boolean Intersect(AxisAlignedBox other, out AxisAlignedBox result)
Summary: Computes the intersection of this bounding box with another.
Parameters:
-
other(AxisAlignedBox): The bounding box to intersect with. -
result(AxisAlignedBox): The resulting overlapping bounding box if an intersection occurs; otherwise, an infinite box.
Returns:
- Boolean:
if the boxes intersect; otherwise, .
public Boolean Contains(Vector3f point)
Summary: Determines whether a point lies within or on the boundaries of this bounding box.
Parameters:
point(Vector3f): The 3D point to test.
Returns:
- Boolean:
if the point is contained; otherwise, .
public Boolean Contains(AxisAlignedBox other)
Summary: Determines whether another bounding box is completely enclosed within this bounding box.
Parameters:
other(AxisAlignedBox): The bounding box to test for containment.
Returns:
- Boolean:
if otheris entirely inside; otherwise,.
public Void Grow(Vector3f point)
Summary: Expands the bounding box to encapsulate the specified point.
Parameters:
point(Vector3f): The point to include.
public Void Grow(AxisAlignedBox other)
Summary: Expands the bounding box to encapsulate another bounding box.
Parameters:
other(AxisAlignedBox): The bounding box to include.
public static AxisAlignedBox Union(AxisAlignedBox a, AxisAlignedBox b)
Summary: Computes the union of two bounding boxes.
Parameters:
-
a(AxisAlignedBox): The first bounding box. -
b(AxisAlignedBox): The second bounding box.
Returns:
- AxisAlignedBox: A new AxisAlignedBox enclosing both inputs.
public Vector3f ClosestPoint(Vector3f point)
Summary: Clamps a point to the boundaries of the bounding box.
Parameters:
point(Vector3f): The point to clamp.
Returns:
- Vector3f: The closest point on or inside the bounding box.
public Single DistanceSquared(Vector3f point)
Summary: Returns the squared distance from a point to the nearest point on the bounding box.
Parameters:
point(Vector3f): The 3D point.
Returns:
- Single: The squared distance.
public Void GetCorners(Span<Vector3f> corners)
Summary: Populates an array of 8 vertices representing the corners of the box.
Parameters:
corners(Span<Vector3f>): A pre-allocated buffer of at least 8 elements to receive the corners.
public Boolean Equals(AxisAlignedBox other)
Summary: Determines whether the specified AxisAlignedBox is equal to the current instance.
Parameters:
other(AxisAlignedBox): The bounding box to compare with this instance.
Returns:
- Boolean:
if both boxes have equal bounds; otherwise, .
public virtual Boolean Equals(Object? obj)
Summary: Determines whether the specified object is equal to the current instance.
Parameters:
obj(Object?): The object to compare with this instance.
Returns:
- Boolean:
if the object is an AxisAlignedBox and matches bounds; otherwise, .
public virtual Int32 GetHashCode()
Summary: Returns the hash code for this bounding box.
Returns:
- Int32: A 32-bit signed integer hash code.
public virtual String ToString()
Summary: Formats the bounding box as a readable string displaying minimum and maximum bounds.
Returns:
- String: A string representation of the bounding box.