lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::scene::AABB Struct Reference

Axis-Aligned Bounding Box (AABB) structure. More...

#include <frustum.hpp>

Public Member Functions

 AABB ()
 Default constructor initializing an empty AABB.
 
 AABB (const glm::vec3 &min, const glm::vec3 &max)
 Parameterized constructor.
 
glm::vec3 get_center () const
 Get the center point of the AABB.
 
glm::vec3 get_extents () const
 Get the extents of the AABB.
 
AABB transform (const glm::mat4 &matrix) const
 Transform the AABB with a matrix.
 
void expand (const glm::vec3 &point)
 Expand the AABB to include a point.
 
void merge (const AABB &other)
 Merge the AABB with another AABB.
 

Public Attributes

glm::vec3 min
 Minimum corner point of the AABB.
 
glm::vec3 max
 Maximum corner point of the AABB.
 

Detailed Description

Axis-Aligned Bounding Box (AABB) structure.

Represents a 3D bounding box defined by minimum and maximum corner points. Provides methods for transformations, expansion, and merging with other AABBs.

Constructor & Destructor Documentation

◆ AABB() [1/2]

lmgl::scene::AABB::AABB ( )
inline

Default constructor initializing an empty AABB.

Initializes min and max to zero vectors.

◆ AABB() [2/2]

lmgl::scene::AABB::AABB ( const glm::vec3 & min,
const glm::vec3 & max )
inline

Parameterized constructor.

Initializes the AABB with specified minimum and maximum corner points.

Parameters
minMinimum corner point.
maxMaximum corner point.

Member Function Documentation

◆ expand()

void lmgl::scene::AABB::expand ( const glm::vec3 & point)

Expand the AABB to include a point.

Expands the AABB to ensure it contains the specified point.

Parameters
pointPoint to include in the AABB.

◆ get_center()

glm::vec3 lmgl::scene::AABB::get_center ( ) const
inline

Get the center point of the AABB.

Calculates and returns the center point of the AABB.

Returns
Center point as a glm::vec3.

◆ get_extents()

glm::vec3 lmgl::scene::AABB::get_extents ( ) const
inline

Get the extents of the AABB.

Calculates and returns the extents (half-size) of the AABB.

Returns
Extents as a glm::vec3.

◆ merge()

void lmgl::scene::AABB::merge ( const AABB & other)

Merge the AABB with another AABB.

Expands the current AABB to include the volume of another AABB.

Parameters
otherThe other AABB to merge with.

◆ transform()

AABB lmgl::scene::AABB::transform ( const glm::mat4 & matrix) const

Transform the AABB with a matrix.

Applies a transformation matrix to the AABB and returns a new transformed AABB.

Parameters
matrixTransformation matrix.
Returns
Transformed AABB.

The documentation for this struct was generated from the following files: