Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SimTK::Geo::Sphere_< P > Class Template Reference

A geometric primitive representing a sphere by its radius and center point, and a collection of sphere-related utility methods. More...

Public Member Functions

 Sphere_ ()
 Construct an uninitialized Sphere object; the center point and radius will be garbage. More...
 
 Sphere_ (const Vec3P &center, RealP radius)
 Construct a sphere from its center location and radius. More...
 
Sphere_setRadius (RealP radius)
 Change the radius of this sphere. More...
 
Sphere_setCenter (const Vec3P &center)
 Change the center location of this sphere. More...
 
Sphere_scaleBy (RealP f)
 Modify this sphere to scale its radius by a fractional amount f, that is we set radius to f*radius. More...
 
Sphere_stretchBoundary ()
 Stretch this sphere in place by a small amount to ensure that there will be no roundoff problems if this is used as a bounding sphere. More...
 
RealP findVolume () const
 Return the volume of this sphere (4/3 pi r^3). More...
 
RealP findArea () const
 Return the surface area of this sphere (4 pi r^2). More...
 
bool isPointOutside (const Vec3P &p) const
 Return true if a given point is strictly outside this sphere. More...
 
bool isPointOutside (const Vec3P &p, RealP tol) const
 Return true if a given point is more than a given tolerance outside the sphere. More...
 
const Vec3PgetCenter () const
 Get the location of the sphere's center point. More...
 
Vec3PupdCenter ()
 Get a writable reference to the sphere's center point. More...
 
RealP getRadius () const
 Get the sphere's radius. More...
 
RealP & updRadius ()
 Get a writable reference to the sphere's radius. More...
 

Detailed Description

template<class P>
class SimTK::Geo::Sphere_< P >

A geometric primitive representing a sphere by its radius and center point, and a collection of sphere-related utility methods.

Constructor & Destructor Documentation

template<class P>
SimTK::Geo::Sphere_< P >::Sphere_ ( )
inline

Construct an uninitialized Sphere object; the center point and radius will be garbage.

template<class P>
SimTK::Geo::Sphere_< P >::Sphere_ ( const Vec3P center,
RealP  radius 
)
inline

Construct a sphere from its center location and radius.

Member Function Documentation

template<class P>
Sphere_& SimTK::Geo::Sphere_< P >::setRadius ( RealP  radius)
inline

Change the radius of this sphere.

template<class P>
Sphere_& SimTK::Geo::Sphere_< P >::setCenter ( const Vec3P center)
inline

Change the center location of this sphere.

template<class P>
Sphere_& SimTK::Geo::Sphere_< P >::scaleBy ( RealP  f)
inline

Modify this sphere to scale its radius by a fractional amount f, that is we set radius to f*radius.

Returns
A reference to this now-resized sphere.
template<class P>
Sphere_& SimTK::Geo::Sphere_< P >::stretchBoundary ( )
inline

Stretch this sphere in place by a small amount to ensure that there will be no roundoff problems if this is used as a bounding sphere.

The amount to stretch depends on the default tolerance for this precision, the radius, and the position of the sphere in space. A very large sphere, or a sphere that is very far from the origin, must be stretched more than a small one at the origin. Cost is 6 flops.

See also
Geo class for tolerance information.
template<class P>
RealP SimTK::Geo::Sphere_< P >::findVolume ( ) const
inline

Return the volume of this sphere (4/3 pi r^3).

template<class P>
RealP SimTK::Geo::Sphere_< P >::findArea ( ) const
inline

Return the surface area of this sphere (4 pi r^2).

template<class P>
bool SimTK::Geo::Sphere_< P >::isPointOutside ( const Vec3P p) const
inline

Return true if a given point is strictly outside this sphere.

Just touching the sphere does not qualify.

template<class P>
bool SimTK::Geo::Sphere_< P >::isPointOutside ( const Vec3P p,
RealP  tol 
) const
inline

Return true if a given point is more than a given tolerance outside the sphere.

template<class P>
const Vec3P& SimTK::Geo::Sphere_< P >::getCenter ( ) const
inline

Get the location of the sphere's center point.

template<class P>
Vec3P& SimTK::Geo::Sphere_< P >::updCenter ( )
inline

Get a writable reference to the sphere's center point.

template<class P>
RealP SimTK::Geo::Sphere_< P >::getRadius ( ) const
inline

Get the sphere's radius.

template<class P>
RealP& SimTK::Geo::Sphere_< P >::updRadius ( )
inline

Get a writable reference to the sphere's radius.


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