1#ifndef SimTK_SIMMATH_GEO_SPHERE_H_
2#define SimTK_SIMMATH_GEO_SPHERE_H_
57: cr(center[0], center[1], center[2], radius) {assert(radius>=0);}
60{ assert(radius>=0); cr[3]=radius;
return *
this; }
79 const RealP tol = Geo::getDefaultTol<P>();
81 const RealP scale = std::max(maxdim,
getRadius());
82 updRadius() += std::max(scale*Geo::getEps<P>(), tol);
Defines geometric primitive shapes and algorthms.
Includes internal headers providing declarations for the basic SimTK Core classes,...
This is the header file that every Simmath compilation unit should include first.
RealP findDistanceSqr(const Vec3P &p2) const
Find the square of the distance between this point and another one whose location is expressed in the...
Definition Geo_Point.h:75
A geometric primitive representing a sphere by its radius and center point, and a collection of spher...
Definition Geo_Sphere.h:47
Sphere_ & setRadius(RealP radius)
Change the radius of this sphere.
Definition Geo_Sphere.h:59
bool isPointOutside(const Vec3P &p) const
Return true if a given point is strictly outside this sphere.
Definition Geo_Sphere.h:95
Sphere_ & scaleBy(RealP f)
Modify this sphere to scale its radius by a fractional amount f, that is we set radius to f*radius.
Definition Geo_Sphere.h:68
Sphere_ & stretchBoundary()
Stretch this sphere in place by a small amount to ensure that there will be no roundoff problems if t...
Definition Geo_Sphere.h:78
RealP getRadius() const
Get the sphere's radius.
Definition Geo_Sphere.h:111
Vec3P & updCenter()
Get a writable reference to the sphere's center point.
Definition Geo_Sphere.h:109
Sphere_()
Construct an uninitialized Sphere object; the center point and radius will be garbage.
Definition Geo_Sphere.h:54
const Vec3P & getCenter() const
Get the location of the sphere's center point.
Definition Geo_Sphere.h:107
bool isPointOutside(const Vec3P &p, RealP tol) const
Return true if a given point is more than a given tolerance outside the sphere.
Definition Geo_Sphere.h:101
Sphere_ & setCenter(const Vec3P ¢er)
Change the center location of this sphere.
Definition Geo_Sphere.h:62
RealP findVolume() const
Return the volume of this sphere (4/3 pi r^3).
Definition Geo_Sphere.h:87
RealP & updRadius()
Get a writable reference to the sphere's radius.
Definition Geo_Sphere.h:113
Sphere_(const Vec3P ¢er, RealP radius)
Construct a sphere from its center location and radius.
Definition Geo_Sphere.h:56
RealP findArea() const
Return the surface area of this sphere (4 pi r^2).
Definition Geo_Sphere.h:90
This is a fixed-length column vector designed for no-overhead inline computation.
Definition Vec.h:184
static const Vec & getAs(const P *p)
Recast an ordinary C++ array E[] to a const Vec<M,E,S>; assumes compatible length,...
Definition Vec.h:904
static Vec & updAs(P *p)
Recast a writable ordinary C++ array E[] to a writable Vec<M,E,S>; assumes compatible length,...
Definition Vec.h:908
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition Assembler.h:37
RowVectorBase< typename CNT< ELEM >::TAbs > abs(const RowVectorBase< ELEM > &v)
Definition VectorMath.h:120
ELEM max(const VectorBase< ELEM > &v)
Definition VectorMath.h:251
unsigned char square(unsigned char u)
Definition Scalar.h:349
unsigned char cube(unsigned char u)
Definition Scalar.h:420