osg::BoundingSphere Class Reference

List of all members.

Public Types

typedef Vec3f vec_type
typedef float value_type

Public Member Functions

 BoundingSphere ()
 BoundingSphere (const vec_type &center, value_type radius)
 BoundingSphere (const BoundingSphere &bs)
 BoundingSphere (const BoundingBox &bb)
void init ()
bool valid () 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
void expandBy (const Vec3f &v)
void expandRadiusBy (const Vec3f &v)
void expandBy (const Vec3d &v)
void expandRadiusBy (const Vec3d &v)
void expandBy (const BoundingSphere &sh)
void expandRadiusBy (const BoundingSphere &sh)
void expandBy (const BoundingBox &bb)
void expandRadiusBy (const BoundingBox &bb)
bool contains (const vec_type &v) const
bool intersects (const BoundingSphere &bs) const

Public Attributes

vec_type _center
value_type _radius


Detailed Description

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


Constructor & Destructor Documentation

osg::BoundingSphere::BoundingSphere (  )  [inline]

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

osg::BoundingSphere::BoundingSphere ( const vec_type center,
value_type  radius 
) [inline]

Creates a bounding sphere initialized to the given extents.

osg::BoundingSphere::BoundingSphere ( const BoundingSphere bs  )  [inline]

Creates a bounding sphere initialized to the given extents.

osg::BoundingSphere::BoundingSphere ( const BoundingBox bb  )  [inline]

Creates a bounding sphere initialized to the given extents.


Member Function Documentation

void osg::BoundingSphere::init (  )  [inline]

Clear the bounding sphere. Reset to default values.

bool osg::BoundingSphere::valid (  )  const [inline]

Returns true of the bounding sphere extents are valid, false otherwise.

Referenced by intersects().

void osg::BoundingSphere::set ( const vec_type center,
value_type  radius 
) [inline]

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

vec_type& osg::BoundingSphere::center (  )  [inline]

const vec_type& osg::BoundingSphere::center (  )  const [inline]

Returns the const center of the bounding sphere.

value_type& osg::BoundingSphere::radius (  )  [inline]

value_type osg::BoundingSphere::radius (  )  const [inline]

Returns the const radius of the bounding sphere.

value_type osg::BoundingSphere::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.

void osg::BoundingSphere::expandBy ( const Vec3f 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.

void osg::BoundingSphere::expandRadiusBy ( const Vec3f 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.

void osg::BoundingSphere::expandBy ( const Vec3d 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.

void osg::BoundingSphere::expandRadiusBy ( const Vec3d 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.

void osg::BoundingSphere::expandBy ( const BoundingSphere 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.

void osg::BoundingSphere::expandRadiusBy ( const BoundingSphere 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.

void osg::BoundingSphere::expandBy ( const BoundingBox bb  ) 

Expands the sphere to encompass the given box. Repositions the sphere center to minimize the radius increase.

void osg::BoundingSphere::expandRadiusBy ( const BoundingBox bb  ) 

Expands the sphere to encompass the given box. Does not repositions the sphere center.

bool osg::BoundingSphere::contains ( const vec_type v  )  const [inline]

Returns true if v is within the sphere.

bool osg::BoundingSphere::intersects ( const BoundingSphere bs  )  const [inline]

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

References _center, _radius, and valid().


Member Data Documentation


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

Generated on Wed Jul 30 23:59:01 2008 for openscenegraph by  doxygen 1.5.6