OpenSceneGraph
3.0.1
|
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::value_type |
typedef VT osg::BoundingBoxImpl::vec_type |
osg::BoundingBoxImpl::BoundingBoxImpl | ( | ) | [inline] |
Creates an uninitialized bounding box.
Referenced by intersect().
osg::BoundingBoxImpl::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.
Creates a bounding box initialized to the given extents.
const vec_type osg::BoundingBoxImpl::center | ( | ) | const [inline] |
Calculates and returns the bounding box center.
Referenced by osg::BoundingSphereImpl::expandBy(), and osg::BoundingSphereImpl::expandRadiusBy().
bool osg::BoundingBoxImpl::contains | ( | const vec_type & | v | ) | const [inline] |
const vec_type osg::BoundingBoxImpl::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::expandBy(), osg::BoundingSphereImpl::expandRadiusBy(), and osg::Plane::intersect().
void osg::BoundingBoxImpl::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::expandBy(), and osg::Drawable::getBound().
void osg::BoundingBoxImpl::expandBy | ( | value_type | x, |
value_type | y, | ||
value_type | z | ||
) | [inline] |
void osg::BoundingBoxImpl::expandBy | ( | const BoundingBoxImpl & | bb | ) | [inline] |
void osg::BoundingBoxImpl::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::valid(), osg::BoundingSphereImpl::_center, osg::BoundingSphereImpl::_radius, _min, and _max.
void osg::BoundingBoxImpl::init | ( | ) | [inline] |
BoundingBoxImpl osg::BoundingBoxImpl::intersect | ( | const BoundingBoxImpl & | bb | ) | const [inline] |
Returns the intersection of this bounding box and the specified bounding box.
References BoundingBoxImpl(), osg::maximum(), xMin(), yMin(), zMin(), osg::minimum(), xMax(), yMax(), and zMax().
bool osg::BoundingBoxImpl::intersects | ( | const BoundingBoxImpl & | bb | ) | const [inline] |
Return true if this bounding box intersects the specified bounding box.
References osg::maximum(), xMin(), osg::minimum(), xMax(), yMin(), yMax(), zMin(), and zMax().
value_type osg::BoundingBoxImpl::radius | ( | ) | const [inline] |
Calculates and returns the bounding box radius.
References radius2().
Referenced by osg::BoundingSphereImpl::expandBy(), and osg::BoundingSphereImpl::expandRadiusBy().
value_type osg::BoundingBoxImpl::radius2 | ( | ) | const [inline] |
void osg::BoundingBoxImpl::set | ( | value_type | xmin, |
value_type | ymin, | ||
value_type | zmin, | ||
value_type | xmax, | ||
value_type | ymax, | ||
value_type | zmax | ||
) | [inline] |
bool osg::BoundingBoxImpl::valid | ( | ) | const [inline] |
Returns true if the bounding box extents are valid, false otherwise.
Referenced by contains(), osg::BoundingSphereImpl::expandBy(), osg::BoundingSphereImpl::expandRadiusBy(), and osg::CullStack::isCulled().
value_type& osg::BoundingBoxImpl::xMax | ( | ) | [inline] |
References _max.
Referenced by intersect(), intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl::xMax | ( | ) | const [inline] |
References _max.
value_type& osg::BoundingBoxImpl::xMin | ( | ) | [inline] |
References _min.
Referenced by intersect(), intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl::xMin | ( | ) | const [inline] |
References _min.
value_type& osg::BoundingBoxImpl::yMax | ( | ) | [inline] |
References _max.
Referenced by intersect(), intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl::yMax | ( | ) | const [inline] |
References _max.
value_type& osg::BoundingBoxImpl::yMin | ( | ) | [inline] |
References _min.
Referenced by intersect(), intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl::yMin | ( | ) | const [inline] |
References _min.
value_type& osg::BoundingBoxImpl::zMax | ( | ) | [inline] |
References _max.
Referenced by intersect(), intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl::zMax | ( | ) | const [inline] |
References _max.
value_type& osg::BoundingBoxImpl::zMin | ( | ) | [inline] |
References _min.
Referenced by intersect(), intersects(), and osg::Polytope::setToBoundingBox().
value_type osg::BoundingBoxImpl::zMin | ( | ) | const [inline] |
References _min.
![]() | Generated at Mon Oct 3 2011 12:39:41 for the OpenSceneGraph by doxygen 1.7.5. |