Sphere class. More...
#include <sphere3.h>
Public Member Functions | |
Sphere3 () | |
Default constructor. Creates the unit sphere. | |
Sphere3 (const Point3 ¢er, const Scalar &radius) | |
bool | operator== (const Sphere3 &s) const |
bool | operator!= (const Sphere3 &s) const |
Point3 | project (const Point3 &p) const |
Projects point p on current sphere. | |
Scalar | distance (const Point3 &p) const |
Point3 | getCenter () const |
Point3 & | getCenterRef () |
const Point3 & | getCenterRef () const |
Scalar | getRadius () const |
Scalar & | getRadiusRef () |
const Scalar & | getRadiusRef () const |
void | setCenter (const Point3 ¢er) |
void | setRadius (const Scalar &radius) |
void | setValue (const Point3 ¢er, const Scalar &radius) |
bool | isSingular () const |
Returns true if sphere has null radius. |
Sphere class.
Spheres are represented by a centerpoint and a radius. A point belongs to the sphere
if
, where
and
represent the sphere centerpoint and radius, respectively.
|
inline |
Centerpoint and radius constructor. Since the radius must be a positive value, its absolute value is taken (just in case) without issuing warnings or errors.
|
inline |
Signed distance from point p to current sphere.
Positive distance -> Point lies outside the sphere. Null distance -> Point is contained in sphere. Negative distance -> Point lies inside the sphere.
|
inline |
Sets sphere radius. Since the radius must be a positive value, its absolute value is taken (just in case) without issuing warnings or errors.
|
inline |
Sets sphere parameters. Since the radius must be a positive value, its absolute value is taken (just in case) without issuing warnings or errors.