mt
 All Classes Files Functions Enumerations Groups Pages
Public Member Functions | List of all members
mt::Sphere3 Class Reference

Sphere class. More...

#include <sphere3.h>

Public Member Functions

 Sphere3 ()
 Default constructor. Creates the unit sphere.
 Sphere3 (const Point3 &center, 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
Point3getCenterRef ()
const Point3getCenterRef () const
Scalar getRadius () const
Scalar & getRadiusRef ()
const Scalar & getRadiusRef () const
void setCenter (const Point3 &center)
void setRadius (const Scalar &radius)
void setValue (const Point3 &center, const Scalar &radius)
bool isSingular () const
 Returns true if sphere has null radius.

Detailed Description

Sphere class.

Spheres are represented by a centerpoint and a radius. A point $ \mathbf{p} $ belongs to the sphere $ \mathbf{S}(\mathbf{c}, r) $ if $ d(\mathbf{p}, \mathbf{c}) = r $, where $ \mathbf{c} $ and $ r $ represent the sphere centerpoint and radius, respectively.

Constructor & Destructor Documentation

mt::Sphere3::Sphere3 ( const Point3 center,
const Scalar &  radius 
)
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.

Member Function Documentation

Scalar mt::Sphere3::distance ( const Point3 p) const
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.

void mt::Sphere3::setRadius ( const Scalar &  radius)
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.

void mt::Sphere3::setValue ( const Point3 center,
const Scalar &  radius 
)
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.


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