1 #ifndef SimTK_SIMMATH_GEO_SPHERE_H_
2 #define SimTK_SIMMATH_GEO_SPHERE_H_
49 typedef Vec<3,P> Vec3P;
50 typedef Vec<4,P> Vec4P;
56 Sphere_(
const Vec3P& center, RealP radius)
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>();
125 #endif // SimTK_SIMMATH_GEO_SPHERE_H_
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
bool isPointOutside(const Vec3P &p) const
Return true if a given point is strictly outside this sphere.
Definition: Geo_Sphere.h:95
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Sphere_ & setCenter(const Vec3P ¢er)
Change the center location of this sphere.
Definition: Geo_Sphere.h:62
static Vec & updAs(P *p)
Recast a writable ordinary C++ array E[] to a writable Vec; assumes compatible length...
Definition: Vec.h:906
const Vec3P & getCenter() const
Get the location of the sphere's center point.
Definition: Geo_Sphere.h:107
RealP findArea() const
Return the surface area of this sphere (4 pi r^2).
Definition: Geo_Sphere.h:90
RealP findVolume() const
Return the volume of this sphere (4/3 pi r^3).
Definition: Geo_Sphere.h:87
unsigned char square(unsigned char u)
Definition: Scalar.h:351
static const Vec & getAs(const P *p)
Recast an ordinary C++ array E[] to a const Vec; assumes compatible length, stride, and packing.
Definition: Vec.h:902
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
Includes internal headers providing declarations for the basic SimTK Core classes, including Simmatrix.
Sphere_ & setRadius(RealP radius)
Change the radius of this sphere.
Definition: Geo_Sphere.h:59
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
Defines geometric primitive shapes and algorthms.
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
A geometric primitive representing a sphere by its radius and center point, and a collection of spher...
Definition: Geo.h:56
RowVectorBase< typename CNT< ELEM >::TAbs > abs(const RowVectorBase< ELEM > &v)
Definition: VectorMath.h:120
This is the header file that every Simmath compilation unit should include first. ...
Sphere_()
Construct an uninitialized Sphere object; the center point and radius will be garbage.
Definition: Geo_Sphere.h:54
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
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
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
unsigned char cube(unsigned char u)
Definition: Scalar.h:424