Lysa  0.0
Lysa 3D Engine
AABB Struct Reference

Detailed Description

Lightweight structure representing a 3D axis-aligned bounding box in the engine's right-handed coordinate system.

An AABB is defined by its minimum and maximum corners in object or world space. It is commonly used for coarse collision detection, visibility tests (frustum culling), and spatial queries.

Notes:

  • The box is axis-aligned in whatever space its min/max are expressed.
  • Applying a general transform (with rotation/shear) to an AABB requires re-computing a new axis-aligned box that encloses the transformed oriented box; see toGlobal().

Public Member Functions

 AABB () = default
 
 AABB (const float3 &min, const float3 &max)
 
AABB toGlobal (const float4x4 &transform) const
 

Public Attributes

float3 min {}
 
float3 max {}
 

Constructor & Destructor Documentation

AABB ( )
default

Default-construct an empty/invalid AABB with zeroed corners. The box becomes valid once min/max are assigned meaningful values.

AABB ( const float3 &  min,
const float3 &  max 
)
inline

Construct a bounding box from its minimum and maximum corners.

Parameters
minMinimum corner (x/y/z individually less-or-equal to max).
maxMaximum corner (x/y/z individually greater-or-equal to min).

Member Function Documentation

AABB toGlobal ( const float4x4 &  transform) const

Compute the world-space AABB that encloses this box transformed by the given matrix.

The input box is considered to be in local/object space. The result is axis-aligned in the destination space of the transform (typically world space). If the transform contains rotation or shear, the returned AABB will be the minimal axis-aligned box that fully contains the rotated (oriented) box.

Parameters
transform4x4 row-major transform matrix (object -> world).
Returns
The transformed, axis-aligned bounding box.

Member Data Documentation

float3 max {}

Maximum corner of the box (component-wise). Typically corresponds to the right/top/front corner: {max.x, max.y, max.z}.

float3 min {}

Minimum corner of the box (component-wise). Typically corresponds to the left/bottom/back corner: {min.x, min.y, min.z}.