openscenegraph
osg::BoundingSphereImpl< VT > Class Template Reference

#include <BoundingSphere>

Public Types

typedef VT vec_type
typedef VT::value_type value_type

Public Member Functions

 BoundingSphereImpl ()
 BoundingSphereImpl (const vec_type &cntr, value_type rad)
 BoundingSphereImpl (const BoundingSphereImpl &bs)
 BoundingSphereImpl (const BoundingBoxImpl< VT > &bb)
BoundingSphereImploperator= (const BoundingSphereImpl &o)
void init ()
bool valid () const
bool operator== (const BoundingSphereImpl &rhs) const
bool operator!= (const BoundingSphereImpl &rhs) const
void set (const vec_type &center, value_type radius)
vec_typecenter ()
const vec_typecenter () const
value_typeradius ()
value_type radius () const
value_type radius2 () const
template<typename vector_type>
void expandBy (const vector_type &v)
template<typename vector_type>
void expandRadiusBy (const vector_type &v)
void expandBy (const BoundingSphereImpl &sh)
void expandRadiusBy (const BoundingSphereImpl &sh)
template<typename BBT>
void expandBy (const BoundingBoxImpl< BBT > &bb)
template<typename BBT>
void expandRadiusBy (const BoundingBoxImpl< BBT > &bb)
bool contains (const vec_type &v) const
bool intersects (const BoundingSphereImpl &bs) const

Public Attributes

vec_type _center
value_type _radius

Detailed Description

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

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.

Member Typedef Documentation

◆ value_type

template<typename VT>
typedef VT::value_type osg::BoundingSphereImpl< VT >::value_type

◆ vec_type

template<typename VT>
typedef VT osg::BoundingSphereImpl< VT >::vec_type

Constructor & Destructor Documentation

◆ BoundingSphereImpl() [1/4]

template<typename VT>
osg::BoundingSphereImpl< VT >::BoundingSphereImpl ( )
inline

Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere.

Referenced by expandBy(), and expandRadiusBy().

◆ BoundingSphereImpl() [2/4]

template<typename VT>
osg::BoundingSphereImpl< VT >::BoundingSphereImpl ( const vec_type & cntr,
value_type rad )
inline

Creates a bounding sphere initialized to the given extents.

◆ BoundingSphereImpl() [3/4]

template<typename VT>
osg::BoundingSphereImpl< VT >::BoundingSphereImpl ( const BoundingSphereImpl< VT > & bs)
inline

Creates a bounding sphere initialized to the given extents.

◆ BoundingSphereImpl() [4/4]

template<typename VT>
osg::BoundingSphereImpl< VT >::BoundingSphereImpl ( const BoundingBoxImpl< VT > & bb)
inline

Creates a bounding sphere initialized to the given extents.

Member Function Documentation

◆ center() [1/2]

template<typename VT>
vec_type & osg::BoundingSphereImpl< VT >::center ( )
inline

◆ center() [2/2]

template<typename VT>
const vec_type & osg::BoundingSphereImpl< VT >::center ( ) const
inline

Returns the const center of the bounding sphere.

◆ contains()

template<typename VT>
bool osg::BoundingSphereImpl< VT >::contains ( const vec_type & v) const
inline

Returns true if v is within the sphere.

◆ expandBy() [1/3]

template<typename VT>
template<typename BBT>
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().

◆ expandBy() [2/3]

template<typename VT>
void osg::BoundingSphereImpl< VT >::expandBy ( const BoundingSphereImpl< VT > & sh)

Expands the sphere to encompass the given sphere. Repositions the sphere center to minimize the radius increase. If the sphere is uninitialized, set its center and radius to match sh.

References _center, _radius, BoundingSphereImpl(), center(), radius(), and valid().

◆ expandBy() [3/3]

template<typename VT>
template<typename vector_type>
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().

◆ expandRadiusBy() [1/3]

template<typename VT>
template<typename BBT>
void osg::BoundingSphereImpl< VT >::expandRadiusBy ( const BoundingBoxImpl< BBT > & bb)

◆ expandRadiusBy() [2/3]

template<typename VT>
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().

◆ expandRadiusBy() [3/3]

template<typename VT>
template<typename vector_type>
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().

◆ init()

template<typename VT>
void osg::BoundingSphereImpl< VT >::init ( )
inline

Clear the bounding sphere. Reset to default values.

◆ intersects()

template<typename VT>
bool osg::BoundingSphereImpl< VT >::intersects ( const BoundingSphereImpl< VT > & bs) const
inline

Returns true if there is a non-empty intersection with the given bounding sphere.

◆ operator!=()

template<typename VT>
bool osg::BoundingSphereImpl< VT >::operator!= ( const BoundingSphereImpl< VT > & rhs) const
inline

◆ operator=()

template<typename VT>
BoundingSphereImpl & osg::BoundingSphereImpl< VT >::operator= ( const BoundingSphereImpl< VT > & o)
inline

◆ operator==()

template<typename VT>
bool osg::BoundingSphereImpl< VT >::operator== ( const BoundingSphereImpl< VT > & rhs) const
inline

◆ radius() [1/2]

template<typename VT>
value_type & osg::BoundingSphereImpl< VT >::radius ( )
inline

◆ radius() [2/2]

template<typename VT>
value_type osg::BoundingSphereImpl< VT >::radius ( ) const
inline

Returns the const radius of the bounding sphere.

◆ radius2()

template<typename VT>
value_type osg::BoundingSphereImpl< VT >::radius2 ( ) const
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().

◆ set()

template<typename VT>
void osg::BoundingSphereImpl< VT >::set ( const vec_type & center,
value_type radius )
inline

Set the bounding sphere to the given center/radius using floats.

◆ valid()

template<typename VT>
bool osg::BoundingSphereImpl< VT >::valid ( ) const
inline

Member Data Documentation

◆ _center

◆ _radius


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