Struct BoundingBox
- Namespace
- Box3D
- Assembly
- Box3D.NET.dll
An axis-aligned bounding box.
public readonly record struct BoundingBox : IEquatable<BoundingBox>Implements
Inherited Members
Examples
BoundingBox bounds = body.Bounds;
Console.WriteLine($"{bounds.Center} +/- {bounds.Extents}");
if (bounds.Overlaps(cameraFrustumBounds))
{
Draw(body);
}
Constructors
- BoundingBox(Vector3, Vector3)
-
Initializes a new instance of the Box3D.BoundingBox struct.
Properties
- Center
-
Gets the centre.
- Extents
-
Gets the half-widths along each axis.
- Max
-
Gets the corner with the largest coordinates.
- Min
-
Gets the corner with the smallest coordinates.
- Size
-
Gets the full size along each axis.
- SurfaceArea
-
Gets the total surface area.
Methods
- ClosestPoint(Vector3)
-
Returns the closest point inside this box to a target.
- Contains(BoundingBox)
-
Determines whether this box fully contains another.
- FromCenter(Vector3, Vector3)
-
Creates a box centred on a point.
- Inflate(float)
-
Returns this box expanded uniformly on every side.
- Overlaps(BoundingBox)
-
Determines whether this box intersects another.
- Union(BoundingBox)
-
Returns the smallest box containing both this box and another.