OpenSceneGraph
3.0.1
|
General purpose bounding sphere class for enclosing nodes/objects/vertices. More...
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 ¢er, value_type radius) | |
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. | |
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. | |
void | expandBy (const BoundingBoxImpl< VT > &bb) |
Expands the sphere to encompass the given box. | |
void | expandRadiusBy (const BoundingBoxImpl< VT > &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::value_type |
typedef VT osg::BoundingSphereImpl::vec_type |
osg::BoundingSphereImpl::BoundingSphereImpl | ( | ) | [inline] |
Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere.
osg::BoundingSphereImpl::BoundingSphereImpl | ( | const vec_type & | center, |
value_type | radius | ||
) | [inline] |
Creates a bounding sphere initialized to the given extents.
osg::BoundingSphereImpl::BoundingSphereImpl | ( | const BoundingSphereImpl & | bs | ) | [inline] |
Creates a bounding sphere initialized to the given extents.
osg::BoundingSphereImpl::BoundingSphereImpl | ( | const BoundingBoxImpl< VT > & | bb | ) | [inline] |
Creates a bounding sphere initialized to the given extents.
References expandBy().
vec_type& osg::BoundingSphereImpl::center | ( | ) | [inline] |
Returns the center of the bounding sphere.
References _center.
Referenced by set(), osg::CullingSet::pixelSize(), osg::CullingSet::isCulled(), osg::CullStack::pixelSize(), osg::CullStack::clampedPixelSize(), and osg::Plane::intersect().
const vec_type& osg::BoundingSphereImpl::center | ( | ) | const [inline] |
Returns the const center of the bounding sphere.
References _center.
bool osg::BoundingSphereImpl::contains | ( | const vec_type & | v | ) | const [inline] |
void osg::BoundingSphereImpl::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.
Referenced by BoundingSphereImpl(), and osg::Node::getBound().
void osg::BoundingSphereImpl::expandBy | ( | const BoundingSphereImpl & | 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::BoundingSphereImpl::expandBy | ( | const BoundingBoxImpl< VT > & | bb | ) |
Expands the sphere to encompass the given box.
Repositions the sphere center to minimize the radius increase.
References osg::BoundingBoxImpl::valid(), osg::BoundingBoxImpl::corner(), osg::BoundingBoxImpl::expandBy(), osg::BoundingBoxImpl::center(), and osg::BoundingBoxImpl::radius().
void osg::BoundingSphereImpl::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.
void osg::BoundingSphereImpl::expandRadiusBy | ( | const BoundingSphereImpl & | 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::BoundingSphereImpl::expandRadiusBy | ( | const BoundingBoxImpl< VT > & | bb | ) |
Expands the sphere to encompass the given box.
Does not repositions the sphere center.
References osg::BoundingBoxImpl::valid(), osg::BoundingBoxImpl::corner(), osg::BoundingBoxImpl::center(), and osg::BoundingBoxImpl::radius().
void osg::BoundingSphereImpl::init | ( | ) | [inline] |
bool osg::BoundingSphereImpl::intersects | ( | const BoundingSphereImpl & | bs | ) | const [inline] |
value_type& osg::BoundingSphereImpl::radius | ( | ) | [inline] |
Returns the radius of the bounding sphere.
References _radius.
Referenced by set(), osg::CullingSet::pixelSize(), osg::CullingSet::isCulled(), osg::CullStack::pixelSize(), osg::CullStack::clampedPixelSize(), and osg::Plane::intersect().
value_type osg::BoundingSphereImpl::radius | ( | ) | const [inline] |
Returns the const radius of the bounding sphere.
References _radius.
value_type osg::BoundingSphereImpl::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.
References _radius.
Referenced by contains().
void osg::BoundingSphereImpl::set | ( | const vec_type & | center, |
value_type | radius | ||
) | [inline] |
bool osg::BoundingSphereImpl::valid | ( | ) | const [inline] |
Returns true of the bounding sphere extents are valid, false otherwise.
References _radius.
Referenced by osg::BoundingBoxImpl::expandBy(), contains(), and intersects().
Referenced by osg::BoundingBoxImpl::expandBy(), init(), set(), center(), contains(), and intersects().
Referenced by osg::BoundingBoxImpl::expandBy(), init(), valid(), set(), radius(), radius2(), and intersects().
![]() | Generated at Mon Oct 3 2011 12:39:41 for the OpenSceneGraph by doxygen 1.7.5. |