OpenSceneGraph 3.6.5
|
General purpose bounding sphere class for enclosing nodes/objects/vertices. More...
#include <BoundingSphere>
Public Types | |
typedef VT | vec_type |
typedef VT::value_type | value_type |
Public Member Functions | |
BoundingSphereImpl () | |
Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere. | |
BoundingSphereImpl (const vec_type &cntr, value_type rad) | |
Creates a bounding sphere initialized to the given extents. | |
BoundingSphereImpl (const BoundingSphereImpl &bs) | |
Creates a bounding sphere initialized to the given extents. | |
BoundingSphereImpl (const BoundingBoxImpl< VT > &bb) | |
Creates a bounding sphere initialized to the given extents. | |
void | init () |
Clear the bounding sphere. | |
bool | valid () const |
Returns true of the bounding sphere extents are valid, false otherwise. | |
bool | operator== (const BoundingSphereImpl &rhs) const |
bool | operator!= (const BoundingSphereImpl &rhs) const |
void | set (const vec_type ¢er, value_type radius) |
Set the bounding sphere to the given center/radius using floats. | |
vec_type & | center () |
Returns the center of the bounding sphere. | |
const vec_type & | center () const |
Returns the const center of the bounding sphere. | |
value_type & | radius () |
Returns the radius of the bounding sphere. | |
value_type | radius () const |
Returns the const radius of the bounding sphere. | |
value_type | radius2 () const |
Returns the squared length of the radius. | |
template<typename vector_type> | |
void | expandBy (const vector_type &v) |
Expands the sphere to encompass the given point. | |
template<typename vector_type> | |
void | expandRadiusBy (const vector_type &v) |
Expands the sphere to encompass the given point. | |
void | expandBy (const BoundingSphereImpl &sh) |
Expands the sphere to encompass the given sphere. | |
void | expandRadiusBy (const BoundingSphereImpl &sh) |
Expands the sphere to encompass the given sphere. | |
template<typename BBT> | |
void | expandBy (const BoundingBoxImpl< BBT > &bb) |
Expands the sphere to encompass the given box. | |
template<typename BBT> | |
void | expandRadiusBy (const BoundingBoxImpl< BBT > &bb) |
Expands the sphere to encompass the given box. | |
bool | contains (const vec_type &v) const |
Returns true if v is within the sphere. | |
bool | intersects (const BoundingSphereImpl &bs) const |
Returns true if there is a non-empty intersection with the given bounding sphere. |
Public Attributes | |
vec_type | _center |
value_type | _radius |
General purpose bounding sphere class for enclosing nodes/objects/vertices.
Bounds internal osg::Nodes in the scene, assists in view frustum culling, etc. Similar in function to BoundingBox, it's quicker for evaluating culling but generally will not cull as aggressively because it encloses a greater volume.
typedef VT::value_type osg::BoundingSphereImpl< VT >::value_type |
typedef VT osg::BoundingSphereImpl< VT >::vec_type |
|
inline |
Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere.
Referenced by expandBy(), and expandRadiusBy().
|
inline |
Creates a bounding sphere initialized to the given extents.
|
inline |
Creates a bounding sphere initialized to the given extents.
|
inline |
Creates a bounding sphere initialized to the given extents.
|
inline |
Returns the center of the bounding sphere.
Referenced by osg::CullStack::clampedPixelSize(), expandBy(), osg::Plane::intersect(), osg::CullingSet::isCulled(), osg::CullingSet::pixelSize(), and osg::CullStack::pixelSize().
|
inline |
Returns the const center of the bounding sphere.
|
inline |
Returns true if v is within the sphere.
void osg::BoundingSphereImpl< VT >::expandBy | ( | const BoundingBoxImpl< BBT > & | bb | ) |
Expands the sphere to encompass the given box.
Repositions the sphere center to minimize the radius increase.
References _center, _radius, osg::BoundingBoxImpl< VT >::center(), osg::BoundingBoxImpl< VT >::corner(), osg::BoundingBoxImpl< VT >::expandBy(), osg::BoundingBoxImpl< VT >::radius(), osg::BoundingBoxImpl< VT >::valid(), and valid().
void osg::BoundingSphereImpl< VT >::expandBy | ( | const BoundingSphereImpl< VT > & | sh | ) |
void osg::BoundingSphereImpl< VT >::expandBy | ( | const vector_type & | v | ) |
Expands the sphere to encompass the given point.
Repositions the sphere center to minimize the radius increase. If the sphere is uninitialized, set its center to v and radius to zero.
References _center, _radius, and valid().
Referenced by osg::BoundingSphereImpl< Vec3f >::BoundingSphereImpl().
void osg::BoundingSphereImpl< VT >::expandRadiusBy | ( | const BoundingBoxImpl< BBT > & | bb | ) |
Expands the sphere to encompass the given box.
Does not repositions the sphere center.
References _center, _radius, osg::BoundingBoxImpl< VT >::center(), osg::BoundingBoxImpl< VT >::corner(), expandRadiusBy(), osg::BoundingBoxImpl< VT >::radius(), osg::BoundingBoxImpl< VT >::valid(), and valid().
void osg::BoundingSphereImpl< VT >::expandRadiusBy | ( | const BoundingSphereImpl< VT > & | sh | ) |
Expands the sphere to encompass the given sphere.
Does not repositions the sphere center. If the sphere is uninitialized, set its center and radius to match sh.
References _center, _radius, BoundingSphereImpl(), and valid().
void osg::BoundingSphereImpl< VT >::expandRadiusBy | ( | const vector_type & | v | ) |
Expands the sphere to encompass the given point.
Does not reposition the sphere center. If the sphere is uninitialized, set its center to v and radius to zero.
References _center, _radius, and valid().
Referenced by expandRadiusBy().
|
inline |
Clear the bounding sphere.
Reset to default values.
|
inline |
Returns true if there is a non-empty intersection with the given bounding sphere.
|
inline |
|
inline |
|
inline |
Returns the radius of the bounding sphere.
Referenced by osg::CullStack::clampedPixelSize(), expandBy(), osg::Plane::intersect(), osg::CullingSet::isCulled(), osg::CullingSet::pixelSize(), and osg::CullStack::pixelSize().
|
inline |
Returns the const radius of the bounding sphere.
|
inline |
Returns the squared length of the radius.
Note, For performance reasons, the calling method is responsible for checking to make sure the sphere is valid.
Referenced by osg::BoundingSphereImpl< Vec3f >::contains().
|
inline |
Set the bounding sphere to the given center/radius using floats.
|
inline |
Returns true of the bounding sphere extents are valid, false otherwise.
Referenced by osg::BoundingSphereImpl< Vec3f >::contains(), osg::BoundingBoxImpl< Vec3f >::expandBy(), expandBy(), expandBy(), expandBy(), expandRadiusBy(), expandRadiusBy(), expandRadiusBy(), and osg::BoundingSphereImpl< Vec3f >::intersects().
vec_type osg::BoundingSphereImpl< VT >::_center |
value_type osg::BoundingSphereImpl< VT >::_radius |
![]() | Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0. |