openscenegraph
|
Public Types | |
typedef VT | vec_type |
typedef VT::value_type | value_type |
Public Member Functions | |
BoundingSphereImpl () | |
BoundingSphereImpl (const vec_type ¢er, value_type radius) | |
BoundingSphereImpl (const BoundingSphereImpl &bs) | |
BoundingSphereImpl (const BoundingBoxImpl< VT > &bb) | |
void | init () |
bool | valid () const |
void | set (const vec_type ¢er, value_type radius) |
vec_type & | center () |
const vec_type & | center () const |
value_type & | radius () |
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) |
void | expandBy (const BoundingBoxImpl< VT > &bb) |
void | expandRadiusBy (const BoundingBoxImpl< VT > &bb) |
bool | contains (const vec_type &v) const |
bool | intersects (const BoundingSphereImpl &bs) const |
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< VT >::value_type |
typedef VT osg::BoundingSphereImpl< VT >::vec_type |
osg::BoundingSphereImpl< VT >::BoundingSphereImpl | ( | ) | [inline] |
Construct a default bounding sphere with radius to -1.0f, representing an invalid/unset bounding sphere.
osg::BoundingSphereImpl< VT >::BoundingSphereImpl | ( | const vec_type & | center, |
value_type | radius | ||
) | [inline] |
Creates a bounding sphere initialized to the given extents.
osg::BoundingSphereImpl< VT >::BoundingSphereImpl | ( | const BoundingSphereImpl< VT > & | bs | ) | [inline] |
Creates a bounding sphere initialized to the given extents.
osg::BoundingSphereImpl< VT >::BoundingSphereImpl | ( | const BoundingBoxImpl< VT > & | bb | ) | [inline] |
Creates a bounding sphere initialized to the given extents.
References osg::BoundingSphereImpl< VT >::expandBy().
vec_type& osg::BoundingSphereImpl< VT >::center | ( | ) | [inline] |
Returns the center of the bounding sphere.
References osg::BoundingSphereImpl< VT >::_center.
Referenced by osg::CullStack::clampedPixelSize(), osg::BoundingSphereImpl< VT >::expandBy(), osg::Plane::intersect(), osg::CullingSet::isCulled(), osg::CullStack::pixelSize(), osg::CullingSet::pixelSize(), and osg::BoundingSphereImpl< VT >::set().
const vec_type& osg::BoundingSphereImpl< VT >::center | ( | ) | const [inline] |
Returns the const center of the bounding sphere.
References osg::BoundingSphereImpl< VT >::_center.
bool osg::BoundingSphereImpl< VT >::contains | ( | const vec_type & | v | ) | const [inline] |
Returns true if v is within the sphere.
References osg::BoundingSphereImpl< VT >::_center, osg::BoundingSphereImpl< VT >::radius2(), and osg::BoundingSphereImpl< VT >::valid().
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.
Referenced by osg::BoundingSphereImpl< VT >::BoundingSphereImpl(), and osg::Node::getBound().
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 osg::BoundingSphereImpl< VT >::_center, osg::BoundingSphereImpl< VT >::_radius, osg::BoundingSphereImpl< VT >::center(), osg::BoundingSphereImpl< VT >::radius(), and osg::BoundingSphereImpl< VT >::valid().
void osg::BoundingSphereImpl< VT >::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< VT >::center(), osg::BoundingBoxImpl< VT >::corner(), osg::BoundingBoxImpl< VT >::expandBy(), osg::BoundingBoxImpl< VT >::radius(), and osg::BoundingBoxImpl< VT >::valid().
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.
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 osg::BoundingSphereImpl< VT >::_center, osg::BoundingSphereImpl< VT >::_radius, and osg::BoundingSphereImpl< VT >::valid().
void osg::BoundingSphereImpl< VT >::expandRadiusBy | ( | const BoundingBoxImpl< VT > & | bb | ) |
Expands the sphere to encompass the given box. Does not repositions the sphere center.
References osg::BoundingBoxImpl< VT >::center(), osg::BoundingBoxImpl< VT >::corner(), osg::BoundingBoxImpl< VT >::radius(), and osg::BoundingBoxImpl< VT >::valid().
void osg::BoundingSphereImpl< VT >::init | ( | ) | [inline] |
Clear the bounding sphere. Reset to default values.
References osg::BoundingSphereImpl< VT >::_center, and osg::BoundingSphereImpl< VT >::_radius.
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.
References osg::BoundingSphereImpl< VT >::_center, osg::BoundingSphereImpl< VT >::_radius, and osg::BoundingSphereImpl< VT >::valid().
value_type osg::BoundingSphereImpl< VT >::radius | ( | ) | const [inline] |
Returns the const radius of the bounding sphere.
References osg::BoundingSphereImpl< VT >::_radius.
value_type& osg::BoundingSphereImpl< VT >::radius | ( | ) | [inline] |
Returns the radius of the bounding sphere.
References osg::BoundingSphereImpl< VT >::_radius.
Referenced by osg::CullStack::clampedPixelSize(), osg::BoundingSphereImpl< VT >::expandBy(), osg::Plane::intersect(), osg::CullingSet::isCulled(), osg::CullStack::pixelSize(), osg::CullingSet::pixelSize(), and osg::BoundingSphereImpl< VT >::set().
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.
References osg::BoundingSphereImpl< VT >::_radius.
Referenced by osg::BoundingSphereImpl< VT >::contains().
void osg::BoundingSphereImpl< VT >::set | ( | const vec_type & | center, |
value_type | radius | ||
) | [inline] |
Set the bounding sphere to the given center/radius using floats.
References osg::BoundingSphereImpl< VT >::_center, osg::BoundingSphereImpl< VT >::_radius, osg::BoundingSphereImpl< VT >::center(), and osg::BoundingSphereImpl< VT >::radius().
bool osg::BoundingSphereImpl< VT >::valid | ( | ) | const [inline] |
Returns true of the bounding sphere extents are valid, false otherwise.
References osg::BoundingSphereImpl< VT >::_radius.
Referenced by osg::BoundingSphereImpl< VT >::contains(), osg::BoundingSphereImpl< VT >::expandBy(), osg::BoundingBoxImpl< VT >::expandBy(), osg::BoundingSphereImpl< VT >::expandRadiusBy(), and osg::BoundingSphereImpl< VT >::intersects().
vec_type osg::BoundingSphereImpl< VT >::_center |
Referenced by osg::BoundingSphereImpl< VT >::center(), osg::BoundingSphereImpl< VT >::contains(), osg::BoundingSphereImpl< VT >::expandBy(), osg::BoundingBoxImpl< VT >::expandBy(), osg::BoundingSphereImpl< VT >::expandRadiusBy(), osg::BoundingSphereImpl< VT >::init(), osg::BoundingSphereImpl< VT >::intersects(), and osg::BoundingSphereImpl< VT >::set().
value_type osg::BoundingSphereImpl< VT >::_radius |
Referenced by osg::BoundingSphereImpl< VT >::expandBy(), osg::BoundingBoxImpl< VT >::expandBy(), osg::BoundingSphereImpl< VT >::expandRadiusBy(), osg::BoundingSphereImpl< VT >::init(), osg::BoundingSphereImpl< VT >::intersects(), osg::BoundingSphereImpl< VT >::radius(), osg::BoundingSphereImpl< VT >::radius2(), osg::BoundingSphereImpl< VT >::set(), and osg::BoundingSphereImpl< VT >::valid().