Simbody
3.4 (development)
|
A geometric primitive representing a sphere by its radius and center point, and a collection of sphere-related utility methods. More...
#include <Geo_Sphere.h>
Public Member Functions | |
Sphere_ () | |
Construct an uninitialized Sphere object; the center point and radius will be garbage. | |
Sphere_ (const Vec3P ¢er, RealP radius) | |
Construct a sphere from its center location and radius. | |
Sphere_ & | setRadius (RealP radius) |
Change the radius of this sphere. | |
Sphere_ & | setCenter (const Vec3P ¢er) |
Change the center location of this sphere. | |
Sphere_ & | scaleBy (RealP f) |
Modify this sphere to scale its radius by a fractional amount f, that is we set radius to f*radius. | |
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. | |
RealP | findVolume () const |
Return the volume of this sphere (4/3 pi r^3). | |
RealP | findArea () const |
Return the surface area of this sphere (4 pi r^2). | |
bool | isPointOutside (const Vec3P &p) const |
Return true if a given point is strictly outside this sphere. | |
bool | isPointOutside (const Vec3P &p, RealP tol) const |
Return true if a given point is more than a given tolerance outside the sphere. | |
const Vec3P & | getCenter () const |
Get the location of the sphere's center point. | |
Vec3P & | updCenter () |
Get a writable reference to the sphere's center point. | |
RealP | getRadius () const |
Get the sphere's radius. | |
RealP & | updRadius () |
Get a writable reference to the sphere's radius. |
A geometric primitive representing a sphere by its radius and center point, and a collection of sphere-related utility methods.
SimTK::Geo::Sphere_< P >::Sphere_ | ( | ) | [inline] |
Construct an uninitialized Sphere object; the center point and radius will be garbage.
SimTK::Geo::Sphere_< P >::Sphere_ | ( | const Vec3P & | center, |
RealP | radius | ||
) | [inline] |
Construct a sphere from its center location and radius.
Sphere_& SimTK::Geo::Sphere_< P >::setRadius | ( | RealP | radius | ) | [inline] |
Change the radius of this sphere.
Sphere_& SimTK::Geo::Sphere_< P >::setCenter | ( | const Vec3P & | center | ) | [inline] |
Change the center location of this sphere.
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.
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.
RealP SimTK::Geo::Sphere_< P >::findVolume | ( | ) | const [inline] |
Return the volume of this sphere (4/3 pi r^3).
RealP SimTK::Geo::Sphere_< P >::findArea | ( | ) | const [inline] |
Return the surface area of this sphere (4 pi r^2).
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.
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.
const Vec3P& SimTK::Geo::Sphere_< P >::getCenter | ( | ) | const [inline] |
Get the location of the sphere's center point.
Vec3P& SimTK::Geo::Sphere_< P >::updCenter | ( | ) | [inline] |
Get a writable reference to the sphere's center point.
RealP SimTK::Geo::Sphere_< P >::getRadius | ( | ) | const [inline] |
Get the sphere's radius.
RealP& SimTK::Geo::Sphere_< P >::updRadius | ( | ) | [inline] |
Get a writable reference to the sphere's radius.