class SG_EXPORT osg::BoundingSphere

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

Public Fields

[more]Vec3 _center
[more]float _radius

Public Methods

[more] BoundingSphere()
construct to invalid values to represent an unset bounding sphere
[more]inline void init()
initialize to invalid values to represent an unset bounding sphere
[more]inline const bool isValid() const
return true if the bounding sphere contains valid values, false if the bounding sphere is effectively unset
[more]inline Vec3& center()
return the center of the bounding sphere
[more]inline const Vec3& center() const
return the const center of the bounding sphere
[more]inline float& radius()
return the radius of the bounding sphere
[more]inline const float radius() const
return the const radius of the bounding sphere
[more]inline const float radius2() const
return the radius squared.
[more]void expandBy(const Vec3& v)
If the vertex is outwith the sphere expand to ecompass vertex.
[more]void expandRadiusBy(const Vec3& v)
If the vertex is outwith the sphere expand radius to ecompass vertex.
[more]void expandBy(const BoundingSphere& sh)
If incomming sphere is outwith the sphere expand to ecompass incomming sphere.
[more]void expandRadiusBy(const BoundingSphere& sh)
If incomming sphere is outwith the sphere expand radius to ecompass incomming sphere.
[more]inline const bool contains(const Vec3& v) const
return true is vertex v is within the sphere
[more]inline const bool intersects( const BoundingSphere& bs ) const
return true if bounding sphere's intersect each other


Documentation

General purpose bounding sphere class for enclosing nodes/objects/vertices. Used to bound internal osg::Node's in the scene, to assist in view frustrum 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.
oVec3 _center

ofloat _radius

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

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

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

oinline Vec3& center()
return the center of the bounding sphere

oinline const Vec3& center() const
return the const center of the bounding sphere

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

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

oinline const float radius2() const
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 eroneously return a positive value.

ovoid expandBy(const Vec3& v)
If the vertex is outwith the sphere expand to ecompass vertex. 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.

ovoid 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

ovoid 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.

ovoid 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.

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

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


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.