vmmlib  1.11.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
 
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 &)
 

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 50 of file aabb.hpp.

Constructor & Destructor Documentation

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

Create an empty bounding box.

Definition at line 120 of file aabb.hpp.

Member Function Documentation

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

Definition at line 197 of file aabb.hpp.

Referenced by 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 180 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 175 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 202 of file aabb.hpp.

Referenced by 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 252 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 152 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 163 of file aabb.hpp.

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

Definition at line 276 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 not identical

Definition at line 192 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 186 of file aabb.hpp.


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