vmmlib  1.13.0
Templatized C++ vector and matrix math library
vmml::AABB< T > Class Template Reference

An axis-aligned bounding box. More...

#include <aabb.hpp>

+ Collaboration diagram for vmml::AABB< T >:

Public Member Functions

 AABB ()
 Create an empty bounding box. More...
 
 AABB (const vector< 3, T > &pMin, const vector< 3, T > &pMax)
 Create a new bounding box from two corner points.
 
 AABB (const vector< 4, T > &sphere)
 Create a new bounding box from a bounding sphere.
 
bool isIn (const vector< 3, T > &point) const
 
bool isIn (const vector< 4, T > &sphere) const
 
bool isInFront (const vector< 4, T > &plane) const
 
const vector< 3, T > & getMin () const
 
const vector< 3, T > & getMax () const
 
void merge (const AABB< T > &aabb)
 Create the union of this and the given bounding box.
 
void merge (const vector< 3, T > &point)
 Create the union of this and the given point.
 
void reset ()
 Clear this bounding box.
 
bool isEmpty () const
 
bool operator== (const AABB< T > &other) const
 
bool operator!= (const AABB< T > &other) const
 
vector< 3, T > getCenter () const
 
vector< 3, T > getSize () const
 
void computeNearFar (const vector< 4, T > &plane, vector< 3, T > &nearPoint, vector< 3, T > &farPoint) const
 Compute the nearest and furthest point of this box relative to the given plane.
 

Static Public Member Functions

static AABB< T > makeUnitBox ()
 

Friends

template<class U >
void lunchbox::byteswap (U &)
 
void staticjson::init (AABB< float > *, staticjson::ObjectHandler *)
 
void staticjson::init (AABB< double > *, staticjson::ObjectHandler *)
 

Detailed Description

template<typename T>
class vmml::AABB< T >

An axis-aligned bounding box.

An empty bounding box has undefined, implementation-specific values. Read operations (getMin(), getMax(), getSize(), isIn(), etc.) have undefined semantics on an empty bounding box. set() and merge() operations will define the bounding box correctly.

Definition at line 47 of file aabb.hpp.

Constructor & Destructor Documentation

template<typename T >
vmml::AABB< T >::AABB ( )

Create an empty bounding box.

Definition at line 157 of file aabb.hpp.

Referenced by vmml::AABB< T >::makeUnitBox().

+ Here is the caller graph for this function:

Member Function Documentation

template<typename T >
vector< 3, T > vmml::AABB< T >::getCenter ( ) const
Returns
the center of this bounding box

Definition at line 255 of file aabb.hpp.

Referenced by vmml::AABB< T >::isInFront(), and vmml::FrustumCuller< T >::test().

+ Here is the caller graph for this function:

template<typename T >
const vector< 3, T > & vmml::AABB< T >::getMax ( ) const
inline
Returns
the maximum corner point

Definition at line 237 of file aabb.hpp.

Referenced by vmml::AABB< T >::merge().

+ Here is the caller graph for this function:

template<typename T >
const vector< 3, T > & vmml::AABB< T >::getMin ( ) const
inline
Returns
the minimum corner point

Definition at line 231 of file aabb.hpp.

Referenced by vmml::AABB< T >::merge().

+ Here is the caller graph for this function:

template<typename T >
vector< 3, T > vmml::AABB< T >::getSize ( ) const
Returns
the size of this bounding box

Definition at line 261 of file aabb.hpp.

Referenced by vmml::AABB< T >::isInFront(), and vmml::FrustumCuller< T >::test().

+ Here is the caller graph for this function:

template<typename T >
bool vmml::AABB< T >::isEmpty ( ) const
inline
Returns
true if this bounding box has not been set

Definition at line 313 of file aabb.hpp.

template<typename T >
bool vmml::AABB< T >::isIn ( const vector< 3, T > &  point) const
inline
Returns
true if the given point is within this bounding box.

Definition at line 195 of file aabb.hpp.

template<typename T >
bool vmml::AABB< T >::isIn ( const vector< 4, T > &  sphere) const
inline
Returns
true if the given sphere is within this bounding box.

Definition at line 206 of file aabb.hpp.

template<typename T >
bool vmml::AABB< T >::isInFront ( const vector< 4, T > &  plane) const
inline
Returns
true if this bounding box is in front of the given plane ([normal.x|y|z, d] notation).

Definition at line 219 of file aabb.hpp.

References vmml::AABB< T >::getCenter(), and vmml::AABB< T >::getSize().

+ Here is the call graph for this function:

template<typename T >
AABB< T > vmml::AABB< T >::makeUnitBox ( )
static
Returns
a bounding box of size one with the minimum point at zero.

Definition at line 339 of file aabb.hpp.

References vmml::AABB< T >::AABB().

+ Here is the call graph for this function:

template<typename T >
bool vmml::AABB< T >::operator!= ( const AABB< T > &  other) const
inline
Returns
true if this and the other bounding box are not identical

Definition at line 249 of file aabb.hpp.

template<typename T >
bool vmml::AABB< T >::operator== ( const AABB< T > &  other) const
inline
Returns
true if this and the other bounding box are identical

Definition at line 243 of file aabb.hpp.


The documentation for this class was generated from the following file: