OpenSceneGraph 2.8.4
|
General purpose axis-aligned bounding box class for enclosing objects/vertices. More...
Public Types | |
typedef VT | vec_type |
typedef VT::value_type | value_type |
Public Member Functions | |
BoundingBoxImpl () | |
Creates an uninitialized bounding box. | |
BoundingBoxImpl (value_type xmin, value_type ymin, value_type zmin, value_type xmax, value_type ymax, value_type zmax) | |
Creates a bounding box initialized to the given extents. | |
BoundingBoxImpl (const vec_type &min, const vec_type &max) | |
Creates a bounding box initialized to the given extents. | |
void | init () |
Clear the bounding box. | |
bool | valid () const |
Returns true if the bounding box extents are valid, false otherwise. | |
void | set (value_type xmin, value_type ymin, value_type zmin, value_type xmax, value_type ymax, value_type zmax) |
Sets the bounding box extents. | |
void | set (const vec_type &min, const vec_type &max) |
Sets the bounding box extents. | |
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 |
Calculates and returns the bounding box center. | |
value_type | radius () const |
Calculates and returns the bounding box radius. | |
value_type | radius2 () const |
Calculates and returns the squared length of the bounding box radius. | |
const vec_type | corner (unsigned int pos) const |
Returns a specific corner of the bounding box. | |
void | expandBy (const vec_type &v) |
Expands the bounding box to include the given coordinate. | |
void | expandBy (value_type x, value_type y, value_type z) |
Expands the bounding box to include the given coordinate. | |
void | expandBy (const BoundingBoxImpl &bb) |
Expands this bounding box to include the given bounding box. | |
void | expandBy (const BoundingSphereImpl< VT > &sh) |
Expands this bounding box to include the given sphere. | |
BoundingBoxImpl | intersect (const BoundingBoxImpl &bb) const |
Returns the intersection of this bounding box and the specified bounding box. | |
bool | intersects (const BoundingBoxImpl &bb) const |
Return true if this bounding box intersects the specified bounding box. | |
bool | contains (const vec_type &v) const |
Returns true if this bounding box contains the specified coordinate. | |
Public Attributes | |
vec_type | _min |
Minimum extent. | |
vec_type | _max |
Maximum extent. |
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.
typedef VT::value_type osg::BoundingBoxImpl< VT >::value_type |
typedef VT osg::BoundingBoxImpl< VT >::vec_type |
osg::BoundingBoxImpl< VT >::BoundingBoxImpl | ( | ) | [inline] |
Creates an uninitialized bounding box.
Referenced by osg::BoundingBoxImpl< VT >::intersect().
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.
osg::BoundingBoxImpl< VT >::BoundingBoxImpl | ( | const vec_type & | min, |
const vec_type & | max | ||
) | [inline] |
Creates a bounding box initialized to the given extents.
const vec_type osg::BoundingBoxImpl< VT >::center | ( | ) | const [inline] |
Calculates and returns the bounding box center.
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
Referenced by osg::BoundingSphereImpl< VT >::expandBy(), and osg::BoundingSphereImpl< VT >::expandRadiusBy().
bool osg::BoundingBoxImpl< VT >::contains | ( | const vec_type & | v | ) | const [inline] |
Returns true if this bounding box contains the specified coordinate.
References osg::BoundingBoxImpl< VT >::_max, osg::BoundingBoxImpl< VT >::_min, and osg::BoundingBoxImpl< VT >::valid().
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.
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
Referenced by osg::BoundingSphereImpl< VT >::expandBy(), osg::BoundingSphereImpl< VT >::expandRadiusBy(), and osg::Plane::intersect().
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.
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
Referenced by osg::BoundingSphereImpl< VT >::expandBy(), and osg::Drawable::getBound().
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).
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
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.
References osg::BoundingBoxImpl< VT >::_max, osg::BoundingBoxImpl< VT >::_min, and osg::BoundingBoxImpl< VT >::valid().
void osg::BoundingBoxImpl< VT >::expandBy | ( | const BoundingSphereImpl< VT > & | sh | ) | [inline] |
Expands this bounding box to include the given sphere.
If this box is uninitialized, set it to include sh.
References osg::BoundingSphereImpl< VT >::_center, osg::BoundingBoxImpl< VT >::_max, osg::BoundingBoxImpl< VT >::_min, osg::BoundingSphereImpl< VT >::_radius, and osg::BoundingSphereImpl< VT >::valid().
void osg::BoundingBoxImpl< VT >::init | ( | ) | [inline] |
Clear the bounding box.
Erases existing minimum and maximum extents.
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
BoundingBoxImpl osg::BoundingBoxImpl< VT >::intersect | ( | const BoundingBoxImpl< VT > & | bb | ) | const [inline] |
Returns the intersection of this bounding box and the specified bounding box.
References osg::BoundingBoxImpl< VT >::BoundingBoxImpl(), osg::maximum(), osg::minimum(), osg::BoundingBoxImpl< VT >::xMax(), osg::BoundingBoxImpl< VT >::xMin(), osg::BoundingBoxImpl< VT >::yMax(), osg::BoundingBoxImpl< VT >::yMin(), osg::BoundingBoxImpl< VT >::zMax(), and osg::BoundingBoxImpl< VT >::zMin().
bool osg::BoundingBoxImpl< VT >::intersects | ( | const BoundingBoxImpl< VT > & | bb | ) | const [inline] |
Return true if this bounding box intersects the specified bounding box.
References osg::maximum(), osg::minimum(), osg::BoundingBoxImpl< VT >::xMax(), osg::BoundingBoxImpl< VT >::xMin(), osg::BoundingBoxImpl< VT >::yMax(), osg::BoundingBoxImpl< VT >::yMin(), osg::BoundingBoxImpl< VT >::zMax(), and osg::BoundingBoxImpl< VT >::zMin().
value_type osg::BoundingBoxImpl< VT >::radius | ( | ) | const [inline] |
Calculates and returns the bounding box radius.
References osg::BoundingBoxImpl< VT >::radius2().
Referenced by osg::BoundingSphereImpl< VT >::expandBy(), and osg::BoundingSphereImpl< VT >::expandRadiusBy().
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().
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
Referenced by osg::BoundingBoxImpl< VT >::radius().
void osg::BoundingBoxImpl< VT >::set | ( | const vec_type & | min, |
const vec_type & | max | ||
) | [inline] |
Sets the bounding box extents.
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
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.
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
bool osg::BoundingBoxImpl< VT >::valid | ( | ) | const [inline] |
Returns true if the bounding box extents are valid, false otherwise.
References osg::BoundingBoxImpl< VT >::_max, and osg::BoundingBoxImpl< VT >::_min.
Referenced by osg::BoundingBoxImpl< VT >::contains(), osg::BoundingSphereImpl< VT >::expandBy(), osg::BoundingBoxImpl< VT >::expandBy(), osg::BoundingSphereImpl< VT >::expandRadiusBy(), and osg::CullStack::isCulled().
value_type& osg::BoundingBoxImpl< VT >::xMax | ( | ) | [inline] |
References osg::BoundingBoxImpl< VT >::_max.
Referenced by osg::BoundingBoxImpl< VT >::intersect(), osg::BoundingBoxImpl< VT >::intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl< VT >::xMax | ( | ) | const [inline] |
References osg::BoundingBoxImpl< VT >::_max.
value_type osg::BoundingBoxImpl< VT >::xMin | ( | ) | const [inline] |
References osg::BoundingBoxImpl< VT >::_min.
value_type& osg::BoundingBoxImpl< VT >::xMin | ( | ) | [inline] |
References osg::BoundingBoxImpl< VT >::_min.
Referenced by osg::BoundingBoxImpl< VT >::intersect(), osg::BoundingBoxImpl< VT >::intersects(), and osg::Polytope::setToBoundingBox().
value_type& osg::BoundingBoxImpl< VT >::yMax | ( | ) | [inline] |
References osg::BoundingBoxImpl< VT >::_max.
Referenced by osg::BoundingBoxImpl< VT >::intersect(), osg::BoundingBoxImpl< VT >::intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl< VT >::yMax | ( | ) | const [inline] |
References osg::BoundingBoxImpl< VT >::_max.
value_type osg::BoundingBoxImpl< VT >::yMin | ( | ) | const [inline] |
References osg::BoundingBoxImpl< VT >::_min.
value_type& osg::BoundingBoxImpl< VT >::yMin | ( | ) | [inline] |
References osg::BoundingBoxImpl< VT >::_min.
Referenced by osg::BoundingBoxImpl< VT >::intersect(), osg::BoundingBoxImpl< VT >::intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl< VT >::zMax | ( | ) | const [inline] |
References osg::BoundingBoxImpl< VT >::_max.
value_type& osg::BoundingBoxImpl< VT >::zMax | ( | ) | [inline] |
References osg::BoundingBoxImpl< VT >::_max.
Referenced by osg::BoundingBoxImpl< VT >::intersect(), osg::BoundingBoxImpl< VT >::intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl< VT >::zMin | ( | ) | const [inline] |
References osg::BoundingBoxImpl< VT >::_min.
value_type& osg::BoundingBoxImpl< VT >::zMin | ( | ) | [inline] |
References osg::BoundingBoxImpl< VT >::_min.
Referenced by osg::BoundingBoxImpl< VT >::intersect(), osg::BoundingBoxImpl< VT >::intersects(), and osg::Polytope::setToBoundingBox().
vec_type osg::BoundingBoxImpl< VT >::_max |
Maximum extent.
(Greatest X, Y, and Z values of all coordinates.)
Referenced by osg::BoundingBoxImpl< VT >::center(), osg::BoundingBoxImpl< VT >::contains(), osg::BoundingBoxImpl< VT >::corner(), osg::BoundingBoxImpl< VT >::expandBy(), osg::BoundingBoxImpl< VT >::init(), osg::BoundingBoxImpl< VT >::radius2(), osg::BoundingBoxImpl< VT >::set(), osg::BoundingBoxImpl< VT >::valid(), osg::BoundingBoxImpl< VT >::xMax(), osg::BoundingBoxImpl< VT >::yMax(), and osg::BoundingBoxImpl< VT >::zMax().
vec_type osg::BoundingBoxImpl< VT >::_min |
Minimum extent.
(Smallest X, Y, and Z values of all coordinates.)
Referenced by osg::BoundingBoxImpl< VT >::center(), osg::BoundingBoxImpl< VT >::contains(), osg::BoundingBoxImpl< VT >::corner(), osg::BoundingBoxImpl< VT >::expandBy(), osg::BoundingBoxImpl< VT >::init(), osg::BoundingBoxImpl< VT >::radius2(), osg::BoundingBoxImpl< VT >::set(), osg::BoundingBoxImpl< VT >::valid(), osg::BoundingBoxImpl< VT >::xMin(), osg::BoundingBoxImpl< VT >::yMin(), and osg::BoundingBoxImpl< VT >::zMin().
![]() | Generated at Sun Jan 8 2012 13:16:05 for the OpenSceneGraph by doxygen 1.7.4. |