Skip to content

Box3

Axis-aligned bounding box defined by minimum and maximum corners.

[Box3](/reference/math/box3) represents a 3D volume bounded by two corners: min and max. It is used for spatial queries, frustum culling, and bounding volume computations. All operations assume the box is axis-aligned and defined in local space.

Properties

max Vector3

cpp
Vector3 max { std::numeric_limits<float>::lowest() }

Maximum corner of the box.

min Vector3

cpp
Vector3 min { std::numeric_limits<float>::max() }

Minimum corner of the box.

Functions

ApplyTransform() auto

cpp
auto vglx::Box3::ApplyTransform(const Matrix4 &transform)
ParameterDescription
transform4x4 matrix to apply to the box.

Transforms the box by the given matrix. The resulting box is the axis-aligned bounding box that encloses the transformed corners of the original box.

Box3() constexpr

cpp
vglx::Box3::Box3(const Vector3 &v_min, const Vector3 &v_max)
ParameterDescription
v_minMinimum point.
v_maxMaximum point.

Constructs a Box3 object from minimum and maximum corners.

Center() auto

cpp
auto vglx::Box3::Center() const

Returns the center point of the box.

ExpandWithPoint() auto

cpp
auto vglx::Box3::ExpandWithPoint(const Vector3 &p)
ParameterDescription
pPoint to include in the box.

Expands the box to include the given point. If the point lies outside the current box bounds, the box is enlarged to include it.

IsEmpty() auto

cpp
auto vglx::Box3::IsEmpty() const

Checks whether the box is empty (invalid). A box is considered empty if any component of min exceeds the corresponding component of max, which means it contains no volume.

Reset() auto

cpp
auto vglx::Box3::Reset()

Resets the box to an empty state. This sets min and max to extreme values such that any point expanded into it will become the new bounds.

Translate() auto

cpp
auto vglx::Box3::Translate(const Vector3 &translation)
ParameterDescription
translationVector to add to both min and max.

Translates the box by a constant vector.

Union() auto

cpp
auto vglx::Box3::Union(const Box3 &other)
ParameterDescription
otherThe box to merge into this one.

Expands this box to fully contain another box.

Released under the MIT License.