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

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

#include <omAABB2D.h>

Public Member Functions

 AABB2D ()
 Create a 2D axis-aligned bounding box with no extent centered about the origin. More...
 
 AABB2D (T newMin, T newMax)
 Create a 2D axis-aligned bounding box with the specified minimum and maximum coodinates for both axes. More...
 
 AABB2D (T newXMin, T newXMax, T newYMin, T newYMax)
 Create a 2D axis-aligned bounding box with the specified minimum and maximum coodinates. More...
 
 AABB2D (const VectorND< T, 2 > &center)
 Create a 2D axis-aligned bounding box with the minimum and maximum coordinates equal to the specified vector. More...
 
 AABB2D (const VectorND< T, 2 > &newMin, const VectorND< T, 2 > &newMax)
 Create a 2D axis-aligned bounding box with the specified minimum and maximum coodinates. More...
 
 AABB2D (const VectorND< T, 2 > *points, Size numPoints)
 Create a 2D axis-aligned bounding box for the specified array of points. More...
 
template<typename U >
 operator AABB2D< U > () const
 Cast this bounding box to a bounding box with a different underlying primitive type. More...
 
Bool contains (const AABB2D &bounds) const
 Return whether or not this bounding box completely contains another. More...
 
Bool contains (const VectorND< T, 2 > &coordinate) const
 Return whether or not this bounding box contains the specified coordinate. More...
 
Bool intersects (const AABB2D &bounds) const
 Return whether or not this bounding box intersects another. More...
 
void set (T newXMin, T newXMax, T newYMin, T newYMax)
 Set the minimum and maximum coordinates of the axis-aligned bounding box. More...
 
getWidth () const
 Return the difference between the maximum and minimum X coordinates. More...
 
getHeight () const
 Return the difference between the maximum and minimum Y coordinates. More...
 
VectorND< T, 2 > getSize () const
 Return a vector indicating the axial distances between the minimum and maximum coordinate. More...
 
VectorND< T, 2 > 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, 2 > getCenter () const
 Return the center of the bounding box. More...
 
getArea () const
 Return the area in square units enclosed by this 3D range. More...
 
const VectorND< T, 2 > & 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...
 
void enlargeFor (const VectorND< T, 2 > &point)
 Modify the current bounding box such that it encloses the specified point. More...
 
void enlargeFor (const AABB2D &bounds)
 Modify the current bounding box such that it encloses the specified box. More...
 
AABB2D< T > & operator|= (const VectorND< T, 2 > &point)
 Modify the current bounding box such that it encloses the specified point. More...
 
AABB2D< T > operator| (const VectorND< T, 2 > &point) const
 Return the bounding box necessary to enclose a point and the current bounding box. More...
 
AABB2D< T > getUnion (const AABB2D< T > &bounds) const
 Return the union of this bounding box and another. More...
 
AABB2D< T > & operator|= (const AABB2D< T > &bounds)
 Modify this bounding box such that it contains the specified bounding box. More...
 
AABB2D< T > operator| (const AABB2D< T > &bounds) const
 Return the union of this bounding box and another. More...
 
AABB2D< T > getIntersection (const AABB2D< T > &bounds) const
 Return the intersection of this bounding box and another. More...
 
AABB2D< T > & operator&= (const AABB2D< T > &bounds)
 Return the intersection of this bounding box and another. More...
 
AABB2D< T > operator& (const AABB2D< T > &bounds) const
 Return the intersection of this bounding box and another. More...
 
Bool operator== (const AABB2D< T > &other) const
 Return whether or not this bounding box is exactly the same as another. More...
 
Bool operator!= (const AABB2D< T > &other) const
 Return whether or not this bounding box is different than another. More...
 
AABB2D< T > operator* (T scale) const
 Multiply the minimum and maximum coordinates of this bounding box by the specified scale factor. More...
 
AABB2D< T > operator* (const VectorND< T, 2 > &scale) const
 Multiply the minimum and maximum coordinates of this bounding box by the specified 2D scale factor. More...
 
AABB2D< T > operator/ (T scale) const
 Divide the minimum and maximum coordinates of this bounding box by the specified scale factor. More...
 
AABB2D< T > operator/ (const VectorND< T, 2 > &scale) const
 Divide the minimum and maximum coordinates of this bounding box by the specified 2D 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, 2 > min
 The minumum coordinate of the bounding box. More...
 
VectorND< T, 2 > max
 The maximum coordinate of the bounding box. More...
 

Detailed Description

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

A class that represents a range of values in 2D 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::AABB2D< T >::AABB2D ( )
inline

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

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

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

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

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

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

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

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

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

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

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

Member Function Documentation

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

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

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

Return whether or not this bounding box completely contains another.

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

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

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

Return whether or not this bounding box intersects another.

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

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

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

Return the difference between the maximum and minimum X coordinates.

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

Return the difference between the maximum and minimum Y coordinates.

template<typename T>
VectorND<T,2> om::math::AABB2D< T >::getSize ( ) const
inline

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

template<typename T>
VectorND<T,2> om::math::AABB2D< T >::getDiagonal ( ) const
inline

Return the vector from the minimum coordinate to the maximum.

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

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

template<typename T>
VectorND<T,2> om::math::AABB2D< T >::getCenter ( ) const
inline

Return the center of the bounding box.

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

Return the area in square units enclosed by this 3D range.

template<typename T>
const VectorND<T,2>& om::math::AABB2D< 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::AABB2D< T >::getX ( ) const
inline

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

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

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

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

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

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

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

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

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

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

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

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

Return the union of this bounding box and another.

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

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

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

Return the union of this bounding box and another.

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

Return the intersection of this bounding box and another.

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

Return the intersection of this bounding box and another.

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

Return the intersection of this bounding box and another.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Member Data Documentation

template<typename T>
VectorND<T,2> om::math::AABB2D< T >::min

The minumum coordinate of the bounding box.

template<typename T>
VectorND<T,2> om::math::AABB2D< T >::max

The maximum coordinate of the bounding box.


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