osg::BoundingBoxImpl< VT > Class Template Reference

`#include <BoundingBox>`

## Public Types

typedef VT | vec_type
typedef VT::value_type | value_type

## Public Member Functions

| BoundingBoxImpl ()
template<typename BT>
| BoundingBoxImpl (const BoundingBoxImpl< BT > &bb)
| BoundingBoxImpl (value_type xmin, value_type ymin, value_type zmin, value_type xmax, value_type ymax, value_type zmax)
| BoundingBoxImpl (const vec_type &min, const vec_type &max)
void | init ()
bool | operator== (const BoundingBoxImpl &rhs) const
bool | operator!= (const BoundingBoxImpl &rhs) const
bool | valid () const
void | set (value_type xmin, value_type ymin, value_type zmin, value_type xmax, value_type ymax, value_type zmax)
void | set (const vec_type &min, const vec_type &max)
value_type & | xMin ()
value_type | xMin () const
value_type & | yMin ()
value_type | yMin () const
value_type & | zMin ()
value_type | zMin () const
value_type & | xMax ()
value_type | xMax () const
value_type & | yMax ()
value_type | yMax () const
value_type & | zMax ()
value_type | zMax () const
const vec_type | center () const
value_type | radius () const
value_type | radius2 () const
const vec_type | corner (unsigned int pos) const
void | expandBy (const vec_type &v)
void | expandBy (value_type x, value_type y, value_type z)
void | expandBy (const BoundingBoxImpl &bb)
template<typename BST>
void | expandBy (const BoundingSphereImpl< BST > &sh)
BoundingBoxImpl | intersect (const BoundingBoxImpl &bb) const
bool | intersects (const BoundingBoxImpl &bb) const
bool | contains (const vec_type &v) const
bool | contains (const vec_type &v, value_type epsilon) const

## Public Attributes

vec_type | _min
vec_type | _max

## Detailed Description

template<typename VT>
class osg::BoundingBoxImpl< VT >

General purpose axis-aligned bounding box class for enclosing objects/vertices. Bounds leaf objects in a scene such as osg::Drawable objects. Used for frustum culling etc.

## Member Typedef Documentation

## value_type

template<typename VT>

typedef VT::value_type osg::BoundingBoxImpl< VT >::value_type

## vec_type

template<typename VT>

typedef VT osg::BoundingBoxImpl< VT >::vec_type

## Constructor & Destructor Documentation

## BoundingBoxImpl() [1/4]

template<typename VT>

osg::BoundingBoxImpl< VT >::BoundingBoxImpl | ( |  | ) |

inline

Creates an uninitialized bounding box.

Referenced by osg::BoundingBoxImpl< Vec3f >::intersect().

## BoundingBoxImpl() [2/4]

template<typename VT>
template<typename BT>

osg::BoundingBoxImpl< VT >::BoundingBoxImpl | ( | const BoundingBoxImpl< BT > & | bb | ) |

inline

## BoundingBoxImpl() [3/4]

template<typename VT>

osg::BoundingBoxImpl< VT >::BoundingBoxImpl | ( | value_type | xmin,
|  | value_type | ymin,
|  | value_type | zmin,
|  | value_type | xmax,
|  | value_type | ymax,
|  | value_type | zmax )

inline

Creates a bounding box initialized to the given extents.

## BoundingBoxImpl() [4/4]

template<typename VT>

osg::BoundingBoxImpl< VT >::BoundingBoxImpl | ( | const vec_type & | min,
|  | const vec_type & | max )

inline

Creates a bounding box initialized to the given extents.

## Member Function Documentation

## center()

template<typename VT>

const vec_type osg::BoundingBoxImpl< VT >::center | ( |  | ) | const

inline

Calculates and returns the bounding box center.

Referenced by osg::BoundingSphereImpl< VT >::expandBy(), and osg::BoundingSphereImpl< VT >::expandRadiusBy().

## contains() [1/2]

template<typename VT>

bool osg::BoundingBoxImpl< VT >::contains | ( | const vec_type & | v | ) | const

inline

Returns true if this bounding box contains the specified coordinate.

## contains() [2/2]

template<typename VT>

bool osg::BoundingBoxImpl< VT >::contains | ( | const vec_type & | v,
|  | value_type | epsilon ) const

inline

Returns true if this bounding box contains the specified coordinate allowing for specific epsilon.

## corner()

template<typename VT>

const vec_type osg::BoundingBoxImpl< VT >::corner | ( | unsigned int | pos | ) | const

inline

Returns a specific corner of the bounding box. pos specifies the corner as a number between 0 and 7. Each bit selects an axis, X, Y, or Z from least- to most-significant. Unset bits select the minimum value for that axis, and set bits select the maximum.

Referenced by osg::BoundingSphereImpl< VT >::expandBy(), osg::BoundingSphereImpl< VT >::expandRadiusBy(), and osg::Plane::intersect().

## expandBy() [1/4]

template<typename VT>

void osg::BoundingBoxImpl< VT >::expandBy | ( | const BoundingBoxImpl< VT > & | bb | ) |

inline

Expands this bounding box to include the given bounding box. If this box is uninitialized, set it equal to bb.

## expandBy() [2/4]

template<typename VT>
template<typename BST>

void osg::BoundingBoxImpl< VT >::expandBy | ( | const BoundingSphereImpl< BST > & | sh | ) |

inline

Expands this bounding box to include the given sphere. If this box is uninitialized, set it to include sh.

## expandBy() [3/4]

template<typename VT>

void osg::BoundingBoxImpl< VT >::expandBy | ( | const vec_type & | v | ) |

inline

Expands the bounding box to include the given coordinate. If the box is uninitialized, set its min and max extents to v.

Referenced by osg::BoundingSphereImpl< VT >::expandBy().

## expandBy() [4/4]

template<typename VT>

void osg::BoundingBoxImpl< VT >::expandBy | ( | value_type | x,
|  | value_type | y,
|  | value_type | z )

inline

Expands the bounding box to include the given coordinate. If the box is uninitialized, set its min and max extents to Vec3(x,y,z).

## init()

template<typename VT>

void osg::BoundingBoxImpl< VT >::init | ( |  | ) |

inline

Clear the bounding box. Erases existing minimum and maximum extents.

## intersect()

template<typename VT>

BoundingBoxImpl osg::BoundingBoxImpl< VT >::intersect | ( | const BoundingBoxImpl< VT > & | bb | ) | const

inline

Returns the intersection of this bounding box and the specified bounding box.

## intersects()

template<typename VT>

bool osg::BoundingBoxImpl< VT >::intersects | ( | const BoundingBoxImpl< VT > & | bb | ) | const

inline

Return true if this bounding box intersects the specified bounding box.

## operator!=()

template<typename VT>

bool osg::BoundingBoxImpl< VT >::operator!= | ( | const BoundingBoxImpl< VT > & | rhs | ) | const

inline

## operator==()

template<typename VT>

bool osg::BoundingBoxImpl< VT >::operator== | ( | const BoundingBoxImpl< VT > & | rhs | ) | const

inline

## radius()

template<typename VT>

value_type osg::BoundingBoxImpl< VT >::radius | ( |  | ) | const

inline

Calculates and returns the bounding box radius.

Referenced by osg::BoundingSphereImpl< VT >::expandBy(), and osg::BoundingSphereImpl< VT >::expandRadiusBy().

## radius2()

template<typename VT>

value_type osg::BoundingBoxImpl< VT >::radius2 | ( |  | ) | const

inline

Calculates and returns the squared length of the bounding box radius. Note, radius2() is faster to calculate than radius().

Referenced by osg::BoundingBoxImpl< Vec3f >::radius().

## set() [1/2]

template<typename VT>

void osg::BoundingBoxImpl< VT >::set | ( | const vec_type & | min,
|  | const vec_type & | max )

inline

Sets the bounding box extents.

## set() [2/2]

template<typename VT>

void osg::BoundingBoxImpl< VT >::set | ( | value_type | xmin,
|  | value_type | ymin,
|  | value_type | zmin,
|  | value_type | xmax,
|  | value_type | ymax,
|  | value_type | zmax )

inline

Sets the bounding box extents.

## valid()

template<typename VT>

bool osg::BoundingBoxImpl< VT >::valid | ( |  | ) | const

inline

Returns true if the bounding box extents are valid, false otherwise.

Referenced by osg::BoundingBoxImpl< Vec3f >::contains(), osg::BoundingBoxImpl< Vec3f >::contains(), osg::BoundingBoxImpl< Vec3f >::expandBy(), osg::BoundingSphereImpl< VT >::expandBy(), osg::BoundingSphereImpl< VT >::expandRadiusBy(), and osg::CullStack::isCulled().

## xMax() [1/2]

template<typename VT>

value_type & osg::BoundingBoxImpl< VT >::xMax | ( |  | ) |

inline

Referenced by osg::BoundingBoxImpl< Vec3f >::intersect(), osg::BoundingBoxImpl< Vec3f >::intersects(), and osg::Polytope::setToBoundingBox().

## xMax() [2/2]

template<typename VT>

value_type osg::BoundingBoxImpl< VT >::xMax | ( |  | ) | const

inline

## xMin() [1/2]

template<typename VT>

value_type & osg::BoundingBoxImpl< VT >::xMin | ( |  | ) |

inline

Referenced by osg::BoundingBoxImpl< Vec3f >::intersect(), osg::BoundingBoxImpl< Vec3f >::intersects(), and osg::Polytope::setToBoundingBox().

## xMin() [2/2]

template<typename VT>

value_type osg::BoundingBoxImpl< VT >::xMin | ( |  | ) | const

inline

## yMax() [1/2]

template<typename VT>

value_type & osg::BoundingBoxImpl< VT >::yMax | ( |  | ) |

inline

Referenced by osg::BoundingBoxImpl< Vec3f >::intersect(), osg::BoundingBoxImpl< Vec3f >::intersects(), and osg::Polytope::setToBoundingBox().

## yMax() [2/2]

template<typename VT>

value_type osg::BoundingBoxImpl< VT >::yMax | ( |  | ) | const

inline

## yMin() [1/2]

template<typename VT>

value_type & osg::BoundingBoxImpl< VT >::yMin | ( |  | ) |

inline

Referenced by osg::BoundingBoxImpl< Vec3f >::intersect(), osg::BoundingBoxImpl< Vec3f >::intersects(), and osg::Polytope::setToBoundingBox().

## yMin() [2/2]

template<typename VT>

value_type osg::BoundingBoxImpl< VT >::yMin | ( |  | ) | const

inline

## zMax() [1/2]

template<typename VT>

value_type & osg::BoundingBoxImpl< VT >::zMax | ( |  | ) |

inline

Referenced by osg::BoundingBoxImpl< Vec3f >::intersect(), osg::BoundingBoxImpl< Vec3f >::intersects(), and osg::Polytope::setToBoundingBox().

## zMax() [2/2]

template<typename VT>

value_type osg::BoundingBoxImpl< VT >::zMax | ( |  | ) | const

inline

## zMin() [1/2]

template<typename VT>

value_type & osg::BoundingBoxImpl< VT >::zMin | ( |  | ) |

inline

Referenced by osg::BoundingBoxImpl< Vec3f >::intersect(), osg::BoundingBoxImpl< Vec3f >::intersects(), and osg::Polytope::setToBoundingBox().

## zMin() [2/2]

template<typename VT>

value_type osg::BoundingBoxImpl< VT >::zMin | ( |  | ) | const

inline

## Member Data Documentation

## _max

template<typename VT>

vec_type osg::BoundingBoxImpl< VT >::_max

Maximum extent. (Greatest X, Y, and Z values of all coordinates.)

Referenced by osg::BoundingBoxImpl< Vec3f >::expandBy(), osg::BoundingBoxImpl< Vec3f >::operator!=(), and osg::BoundingBoxImpl< Vec3f >::operator==().

## _min

template<typename VT>

vec_type osg::BoundingBoxImpl< VT >::_min

Minimum extent. (Smallest X, Y, and Z values of all coordinates.)

Referenced by osg::BoundingBoxImpl< Vec3f >::expandBy(), osg::BoundingBoxImpl< Vec3f >::operator!=(), and osg::BoundingBoxImpl< Vec3f >::operator==().

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

- BoundingBox