Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Public Attributes | List of all members
om::math::AABB3D< T > Class Template Reference

A class that represents a range of values in 3D space. More...

#include <omAABB3D.h>

Public Member Functions

 AABB3D ()
 Create a 3D axis-aligned bounding box with no extent centered about the origin. More...
 
 AABB3D (T newMin, T newMax)
 Create a 3D axis-aligned bounding box with the specified minimum and maximum coodinates for all axes. More...
 
 AABB3D (T newXMin, T newXMax, T newYMin, T newYMax, T newZMin, T newZMax)
 Create a 3D axis-aligned bounding box with the specified minimum and maximum coodinates. More...
 
 AABB3D (const VectorND< T, 3 > &center)
 Create a 3D axis-aligned bounding box with the minimum and maximum coordinates equal to the specified vector. More...
 
 AABB3D (const VectorND< T, 3 > &newMin, const VectorND< T, 3 > &newMax)
 Create a 3D axis-aligned bounding box with the specified minimum and maximum coodinates. More...
 
 AABB3D (const VectorND< T, 3 > *points, Size numPoints)
 Create a 3D axis-aligned bounding box for the specified array of points. More...
 
 AABB3D (const AABB2D< T > &bounds2D)
 Create a 3D axis-aligned bounding box from the specified 2D bounding box, setting the Z bounds to [0,0]. More...
 
 AABB3D (const AABB2D< T > &bounds2D, const AABB1D< T > &boundsZ)
 Create a 3D axis-aligned bounding box from the specified 2D bounding box and Z coordinate bounding box. More...
 
template<typename U >
 operator AABB3D< U > () const
 Cast this bounding box to a bounding box with a different underlying primitive type. More...
 
Bool contains (const AABB3D &bounds) const
 Return whether or not this bounding box completely contains another. More...
 
Bool contains (const VectorND< T, 3 > &coordinate) const
 Return whether or not this bounding box contains the specified coordinate. More...
 
Bool intersects (const AABB3D &bounds) const
 Return whether or not this bounding box intersects another. More...
 
void set (T newXMin, T newXMax, T newYMin, T newYMax, T newZMin, T newZMax)
 Set the minimum and maximum coordinates of the axis-aligned bounding box. More...
 
getWidth () const
 Get the difference between the maximum and minimum X coordinates. More...
 
getHeight () const
 Get the difference between the maximum and minimum Y coordinates. More...
 
getDepth () const
 Get the difference between the maximum and minimum Z coordinates. More...
 
VectorND< T, 3 > getSize () const
 Return a vector indicating the axial distances between the minimum and maximum coordinate. More...
 
VectorND< T, 3 > getDiagonal () const
 Return the vector from the minimum coordinate to the maximum. More...
 
getRadius () const
 Return the distance from the center to the farthest corner of the box. More...
 
VectorND< T, 3 > getCenter () const
 Return the center of the bounding box. More...
 
getVolume () const
 Return the volume in cubic units enclosed by this 3D range. More...
 
const VectorND< T, 3 > & getMinMax (Index i) const
 Return either the minimal or maximal vertex of this AABB. More...
 
AABB1D< T > getX () const
 Return a 1D AABB for the X coordinate range of this AABB. More...
 
AABB1D< T > getY () const
 Return a 1D AABB for the Y coordinate range of this AABB. More...
 
AABB1D< T > getZ () const
 Return a 1D AABB for the Z coordinate range of this AABB. More...
 
AABB2D< T > getXY () const
 Return a 2D AABB for the X and Y coordinate ranges of this AABB. More...
 
AABB2D< T > getYZ () const
 Return a 2D AABB for the X and Y coordinate ranges of this AABB. More...
 
AABB2D< T > getXZ () const
 Return a 2D AABB for the X and Z coordinate ranges of this AABB. More...
 
void enlargeFor (const VectorND< T, 3 > &point)
 Modify the current bounding box such that it encloses the specified point. More...
 
void enlargeFor (const AABB3D &bounds)
 Modify the current bounding box such that it encloses the specified box. More...
 
AABB3D< T > & operator|= (const VectorND< T, 3 > &point)
 Modify the current bounding box such that it encloses the specified point. More...
 
AABB3D< T > operator| (const VectorND< T, 3 > &point) const
 Return the bounding box necessary to enclose a point and the current bounding box. More...
 
AABB3D< T > getUnion (const AABB3D< T > &bounds) const
 Return the union of this bounding box and another. More...
 
AABB3D< T > & operator|= (const AABB3D< T > &bounds)
 Modify this bounding box such that it contains the specified bounding box. More...
 
AABB3D< T > operator| (const AABB3D< T > &bounds) const
 Return the union of this bounding box and another. More...
 
AABB3D< T > getIntersection (const AABB3D< T > &bounds) const
 Return the intersection of this bounding box and another. More...
 
AABB3D< T > & operator&= (const AABB3D< T > &bounds)
 Return the intersection of this bounding box and another. More...
 
AABB3D< T > operator& (const AABB3D< T > &bounds) const
 Return the intersection of this bounding box and another. More...
 
Bool operator== (const AABB3D< T > &other) const
 Return whether or not this bounding box is exactly the same as another. More...
 
Bool operator!= (const AABB3D< T > &other) const
 Return whether or not this bounding box is different than another. More...
 
AABB3D< T > operator* (T scale) const
 Multiply the minimum and maximum coordinates of this bounding box by the specified scale factor. More...
 
AABB3D< T > operator* (const VectorND< T, 3 > &scale) const
 Multiply the minimum and maximum coordinates of this bounding box by the specified 3D scale factor. More...
 
AABB3D< T > operator/ (T scale) const
 Divide the minimum and maximum coordinates of this bounding box by the specified scale factor. More...
 
AABB3D< T > operator/ (const VectorND< T, 3 > &scale) const
 Divide the minimum and maximum coordinates of this bounding box by the specified 3D scale factor. More...
 
data::String toString () const
 Convert this 2D range into a human-readable string representation. More...
 
 operator data::String () const
 Convert this 2D range into a human-readable string representation. More...
 

Public Attributes

VectorND< T, 3 > min
 The minumum coordinate of the bounding box. More...
 
VectorND< T, 3 > max
 The maximum coordinate of the bounding box. More...
 

Detailed Description

template<typename T>
class om::math::AABB3D< T >

A class that represents a range of values in 3D space.

This class contains two data members: min and max. These indicate the minimum and maximum coordinates that this axis-aligned bounding box represents. The class invariant is that min is less than max (on at least one dimension), though this is not enforced. The class supports union, containment, and intersection operations.

Constructor & Destructor Documentation

template<typename T>
om::math::AABB3D< T >::AABB3D ( )
inline

Create a 3D axis-aligned bounding box with no extent centered about the origin.

template<typename T>
om::math::AABB3D< T >::AABB3D ( newMin,
newMax 
)
inline

Create a 3D axis-aligned bounding box with the specified minimum and maximum coodinates for all axes.

template<typename T>
om::math::AABB3D< T >::AABB3D ( newXMin,
newXMax,
newYMin,
newYMax,
newZMin,
newZMax 
)
inline

Create a 3D axis-aligned bounding box with the specified minimum and maximum coodinates.

template<typename T>
om::math::AABB3D< T >::AABB3D ( const VectorND< T, 3 > &  center)
inline

Create a 3D axis-aligned bounding box with the minimum and maximum coordinates equal to the specified vector.

template<typename T>
om::math::AABB3D< T >::AABB3D ( const VectorND< T, 3 > &  newMin,
const VectorND< T, 3 > &  newMax 
)
inline

Create a 3D axis-aligned bounding box with the specified minimum and maximum coodinates.

template<typename T>
om::math::AABB3D< T >::AABB3D ( const VectorND< T, 3 > *  points,
Size  numPoints 
)
inline

Create a 3D axis-aligned bounding box for the specified array of points.

template<typename T>
om::math::AABB3D< T >::AABB3D ( const AABB2D< T > &  bounds2D)
inlineexplicit

Create a 3D axis-aligned bounding box from the specified 2D bounding box, setting the Z bounds to [0,0].

template<typename T>
om::math::AABB3D< T >::AABB3D ( const AABB2D< T > &  bounds2D,
const AABB1D< T > &  boundsZ 
)
inlineexplicit

Create a 3D axis-aligned bounding box from the specified 2D bounding box and Z coordinate bounding box.

Member Function Documentation

template<typename T>
template<typename U >
om::math::AABB3D< T >::operator AABB3D< U > ( ) const
inline

Cast this bounding box to a bounding box with a different underlying primitive type.

template<typename T>
Bool om::math::AABB3D< T >::contains ( const AABB3D< T > &  bounds) const
inline

Return whether or not this bounding box completely contains another.

template<typename T>
Bool om::math::AABB3D< T >::contains ( const VectorND< T, 3 > &  coordinate) const
inline

Return whether or not this bounding box contains the specified coordinate.

template<typename T>
Bool om::math::AABB3D< T >::intersects ( const AABB3D< T > &  bounds) const
inline

Return whether or not this bounding box intersects another.

template<typename T>
void om::math::AABB3D< T >::set ( newXMin,
newXMax,
newYMin,
newYMax,
newZMin,
newZMax 
)
inline

Set the minimum and maximum coordinates of the axis-aligned bounding box.

template<typename T>
T om::math::AABB3D< T >::getWidth ( ) const
inline

Get the difference between the maximum and minimum X coordinates.

template<typename T>
T om::math::AABB3D< T >::getHeight ( ) const
inline

Get the difference between the maximum and minimum Y coordinates.

template<typename T>
T om::math::AABB3D< T >::getDepth ( ) const
inline

Get the difference between the maximum and minimum Z coordinates.

template<typename T>
VectorND<T,3> om::math::AABB3D< T >::getSize ( ) const
inline

Return a vector indicating the axial distances between the minimum and maximum coordinate.

template<typename T>
VectorND<T,3> om::math::AABB3D< T >::getDiagonal ( ) const
inline

Return the vector from the minimum coordinate to the maximum.

template<typename T>
T om::math::AABB3D< T >::getRadius ( ) const
inline

Return the distance from the center to the farthest corner of the box.

template<typename T>
VectorND<T,3> om::math::AABB3D< T >::getCenter ( ) const
inline

Return the center of the bounding box.

template<typename T>
T om::math::AABB3D< T >::getVolume ( ) const
inline

Return the volume in cubic units enclosed by this 3D range.

template<typename T>
const VectorND<T,3>& om::math::AABB3D< T >::getMinMax ( Index  i) const
inline

Return either the minimal or maximal vertex of this AABB.

If the index parameter is 0, the minimal vertex is returned, if the index parameter is 1, the maximal vertex is returned. Otherwise the result is undefined.

template<typename T>
AABB1D<T> om::math::AABB3D< T >::getX ( ) const
inline

Return a 1D AABB for the X coordinate range of this AABB.

template<typename T>
AABB1D<T> om::math::AABB3D< T >::getY ( ) const
inline

Return a 1D AABB for the Y coordinate range of this AABB.

template<typename T>
AABB1D<T> om::math::AABB3D< T >::getZ ( ) const
inline

Return a 1D AABB for the Z coordinate range of this AABB.

template<typename T>
AABB2D<T> om::math::AABB3D< T >::getXY ( ) const
inline

Return a 2D AABB for the X and Y coordinate ranges of this AABB.

template<typename T>
AABB2D<T> om::math::AABB3D< T >::getYZ ( ) const
inline

Return a 2D AABB for the X and Y coordinate ranges of this AABB.

template<typename T>
AABB2D<T> om::math::AABB3D< T >::getXZ ( ) const
inline

Return a 2D AABB for the X and Z coordinate ranges of this AABB.

template<typename T>
void om::math::AABB3D< T >::enlargeFor ( const VectorND< T, 3 > &  point)
inline

Modify the current bounding box such that it encloses the specified point.

template<typename T>
void om::math::AABB3D< T >::enlargeFor ( const AABB3D< T > &  bounds)
inline

Modify the current bounding box such that it encloses the specified box.

template<typename T>
AABB3D<T>& om::math::AABB3D< T >::operator|= ( const VectorND< T, 3 > &  point)
inline

Modify the current bounding box such that it encloses the specified point.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::operator| ( const VectorND< T, 3 > &  point) const
inline

Return the bounding box necessary to enclose a point and the current bounding box.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::getUnion ( const AABB3D< T > &  bounds) const
inline

Return the union of this bounding box and another.

template<typename T>
AABB3D<T>& om::math::AABB3D< T >::operator|= ( const AABB3D< T > &  bounds)
inline

Modify this bounding box such that it contains the specified bounding box.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::operator| ( const AABB3D< T > &  bounds) const
inline

Return the union of this bounding box and another.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::getIntersection ( const AABB3D< T > &  bounds) const
inline

Return the intersection of this bounding box and another.

template<typename T>
AABB3D<T>& om::math::AABB3D< T >::operator&= ( const AABB3D< T > &  bounds)
inline

Return the intersection of this bounding box and another.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::operator& ( const AABB3D< T > &  bounds) const
inline

Return the intersection of this bounding box and another.

template<typename T>
Bool om::math::AABB3D< T >::operator== ( const AABB3D< T > &  other) const
inline

Return whether or not this bounding box is exactly the same as another.

template<typename T>
Bool om::math::AABB3D< T >::operator!= ( const AABB3D< T > &  other) const
inline

Return whether or not this bounding box is different than another.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::operator* ( scale) const
inline

Multiply the minimum and maximum coordinates of this bounding box by the specified scale factor.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::operator* ( const VectorND< T, 3 > &  scale) const
inline

Multiply the minimum and maximum coordinates of this bounding box by the specified 3D scale factor.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::operator/ ( scale) const
inline

Divide the minimum and maximum coordinates of this bounding box by the specified scale factor.

template<typename T>
AABB3D<T> om::math::AABB3D< T >::operator/ ( const VectorND< T, 3 > &  scale) const
inline

Divide the minimum and maximum coordinates of this bounding box by the specified 3D scale factor.

template<typename T>
data::String om::math::AABB3D< T >::toString ( ) const
inline

Convert this 2D range into a human-readable string representation.

template<typename T>
om::math::AABB3D< T >::operator data::String ( ) const
inline

Convert this 2D range into a human-readable string representation.

Member Data Documentation

template<typename T>
VectorND<T,3> om::math::AABB3D< T >::min

The minumum coordinate of the bounding box.

template<typename T>
VectorND<T,3> om::math::AABB3D< T >::max

The maximum coordinate of the bounding box.


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