Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::BoundingSphere Class Reference

General purpose bounding sphere class for enclosing nodes/objects/vertices. More...

List of all members.

Public Methods

 BoundingSphere ()
 construct to invalid values to represent an unset bounding sphere.

 BoundingSphere (const Vec3 &center, float radius)
 construct to specified bounding sphere.

void init ()
 initialize to invalid values to represent an unset bounding sphere.

const bool valid () const
 return true if the bounding sphere contains valid values, false if the bounding sphere is effectively unset.

void set (const Vec3 &center, float radius)
 set bounding sphere.

Vec3center ()
 return the center of the bounding sphere.

const Vec3center () const
 return the const center of the bounding sphere.

float & radius ()
 return the radius of the bounding sphere.

const float radius () const
 return the const radius of the bounding sphere.

const float radius2 () const
 return the radius squared.

void expandBy (const Vec3 &v)
 If the vertex is out-with the sphere expand to encompass vertex.

void expandRadiusBy (const Vec3 &v)
 If the vertex is outwith the sphere expand radius to ecompass vertex.

void expandBy (const BoundingSphere &sh)
 If incomming sphere is outwith the sphere expand to ecompass incomming sphere.

void expandRadiusBy (const BoundingSphere &sh)
 If incomming sphere is outwith the sphere expand radius to ecompass incomming sphere.

void expandBy (const BoundingBox &bb)
 If incomming box is outwith the sphere expand to ecompass incomming box.

void expandRadiusBy (const BoundingBox &bb)
 If incomming box is outwith the sphere expand radius to ecompass incomming box.

const bool contains (const Vec3 &v) const
 return true is vertex v is within the sphere.

const bool intersects (const BoundingSphere &bs) const
 return true if bounding sphere's intersect each other.


Public Attributes

Vec3 _center
float _radius


Detailed Description

General purpose bounding sphere class for enclosing nodes/objects/vertices.

Used to bound internal osg::Node's in the scene, to assist in view frustum culling etc. Similar in function to BoundingBox but is quicker for evaluating culling, but generally encloses a greater volume than a BoundingBox so will not cull so aggressively.


Constructor & Destructor Documentation

osg::BoundingSphere::BoundingSphere   [inline]
 

construct to invalid values to represent an unset bounding sphere.

osg::BoundingSphere::BoundingSphere const Vec3   center,
float    radius
[inline]
 

construct to specified bounding sphere.


Member Function Documentation

const Vec3& osg::BoundingSphere::center   const [inline]
 

return the const center of the bounding sphere.

Vec3& osg::BoundingSphere::center   [inline]
 

return the center of the bounding sphere.

const bool osg::BoundingSphere::contains const Vec3   v const [inline]
 

return true is vertex v is within the sphere.

void osg::BoundingSphere::expandBy const BoundingBox   bb
 

If incomming box is outwith the sphere expand to ecompass incomming box.

calculates the combination of movement of center and radius which minimizes the radius increase. If this boz is empty then move the centrer to v and set radius to 0.

void osg::BoundingSphere::expandBy const BoundingSphere &    sh
 

If incomming sphere is outwith the sphere expand to ecompass incomming sphere.

calculates the combination of movement of center and radius which minimizes the radius increase. If this sphere is empty then move the centrer to v and set radius to 0.

void osg::BoundingSphere::expandBy const Vec3   v
 

If the vertex is out-with the sphere expand to encompass vertex.

Calculates the combination of movement of center and radius which minimizes the radius increase. If this sphere is empty then move the center to v and set radius to 0.

void osg::BoundingSphere::expandRadiusBy const BoundingBox   bb
 

If incomming box is outwith the sphere expand radius to ecompass incomming box.

Unlike update, does not move the center, just increasing the radius. If this sphere is empty then move the centrer to v and set radius to 0.

void osg::BoundingSphere::expandRadiusBy const BoundingSphere &    sh
 

If incomming sphere is outwith the sphere expand radius to ecompass incomming sphere.

Unlike update, does not move the center, just increasing the radius. If this sphere is empty then move the centrer to v and set radius to 0.

void osg::BoundingSphere::expandRadiusBy const Vec3   v
 

If the vertex is outwith the sphere expand radius to ecompass vertex.

Unlike update, does not move the center, just increasing the radius. If this sphere is empty then move the centrer to v and set radius to 0

void osg::BoundingSphere::init   [inline]
 

initialize to invalid values to represent an unset bounding sphere.

const bool osg::BoundingSphere::intersects const BoundingSphere &    bs const [inline]
 

return true if bounding sphere's intersect each other.

const float osg::BoundingSphere::radius   const [inline]
 

return the const radius of the bounding sphere.

float& osg::BoundingSphere::radius   [inline]
 

return the radius of the bounding sphere.

const float osg::BoundingSphere::radius2   const [inline]
 

return the radius squared.

Note, for performance reasons, assumes the calling method has ensured that the sphere is valid before calling radius2(), i.e. has _radius>=0.0, as it does not check th validity of sphere and will erroneously return a positive value.

void osg::BoundingSphere::set const Vec3   center,
float    radius
[inline]
 

set bounding sphere.

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

return true if the bounding sphere contains valid values, false if the bounding sphere is effectively unset.


Member Data Documentation

Vec3 osg::BoundingSphere::_center
 

float osg::BoundingSphere::_radius
 


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:26 2002 for the Open Scene Graph by doxygen 1.2.16.