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

Bounding Sphere structure. More...

#include <frustum.hpp>

Public Member Functions

 BoundingSphere ()
 Default constructor initializing an empty bounding sphere.
 
 BoundingSphere (const glm::vec3 &center, float radius)
 Parameterized constructor.
 
BoundingSphere transform (const glm::mat4 &matrix) const
 Transform the bounding sphere with a matrix.
 

Static Public Member Functions

static BoundingSphere from_aabb (const AABB &aabb)
 Create a bounding sphere from an AABB.
 

Public Attributes

glm::vec3 center
 Center point of the bounding sphere.
 
float radius
 Radius of the bounding sphere.
 

Detailed Description

Bounding Sphere structure.

Represents a sphere defined by a center point and a radius. Provides methods for creating a bounding sphere from an AABB and for transforming the sphere with a matrix.

Constructor & Destructor Documentation

◆ BoundingSphere() [1/2]

lmgl::scene::BoundingSphere::BoundingSphere ( )
inline

Default constructor initializing an empty bounding sphere.

Initializes center to zero vector and radius to zero.

◆ BoundingSphere() [2/2]

lmgl::scene::BoundingSphere::BoundingSphere ( const glm::vec3 & center,
float radius )
inline

Parameterized constructor.

Initializes the bounding sphere with specified center and radius.

Parameters
centerCenter point of the sphere.
radiusRadius of the sphere.

Member Function Documentation

◆ from_aabb()

BoundingSphere lmgl::scene::BoundingSphere::from_aabb ( const AABB & aabb)
static

Create a bounding sphere from an AABB.

Constructs a bounding sphere that encompasses the given AABB.

Parameters
aabbThe AABB to create the bounding sphere from.
Returns
BoundingSphere that contains the AABB.

◆ transform()

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

Transform the bounding sphere with a matrix.

Applies a transformation matrix to the bounding sphere and returns a new transformed sphere.

Parameters
matrixTransformation matrix.
Returns
Transformed BoundingSphere.

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