To store and treat a sphere. More...

#include <Figure.h>

Inheritance diagram for Sphere:
Figure

Public Member Functions

 Sphere ()
 Default construcor.
 
 Sphere (const Point< real_t > &c, real_t r, int code=1)
 Constructor.
 
void setRadius (real_t r)
 Assign radius of sphere.
 
real_t getRadius () const
 Return radius of sphere.
 
void setCenter (const Point< real_t > &c)
 Assign coordinates of center of sphere.
 
Point< real_t > getCenter () const
 Return coordinates of center of sphere.
 
real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance of a given point from the current sphere.
 
Sphereoperator+= (Point< real_t > a)
 Operator +=.
 
Sphereoperator+= (real_t a)
 Operator *=.
 
virtual real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance from a given point to current figure.
 
void getSignedDistance (const Grid &g, Vect< real_t > &d) const
 Calculate signed distance to current figure with respect to grid points.
 
- Public Member Functions inherited from Figure
 Figure ()
 Default constructor.
 
 Figure (const Figure &f)
 Copy constructor.
 
virtual ~Figure ()
 Destructor.
 
void setCode (int code)
 Choose a code for the domain defined by the figure.
 
Figureoperator= (const Figure &f)
 Operator =.
 
void getSignedDistance (const Grid &g, Vect< real_t > &d) const
 Calculate signed distance to current figure with respect to grid points.
 
real_t dLine (const Point< real_t > &p, const Point< real_t > &a, const Point< real_t > &b) const
 Compute signed distance from a line.
 

Detailed Description

To store and treat a sphere.

Constructor & Destructor Documentation

◆ Sphere()

Sphere ( const Point< real_t > &  c,
real_t  r,
int  code = 1 
)

Constructor.

Parameters
[in]cCoordinates of center of sphere
[in]rRadius
[in]codeCode to assign to the generated sphere [Default: 1]

Member Function Documentation

◆ getSignedDistance() [1/3]

void getSignedDistance ( const Grid g,
Vect< real_t > &  d 
) const

Calculate signed distance to current figure with respect to grid points.

Parameters
[in]gGrid instance
[in]dVect instance containing calculated distance from each grid index to Figure
Remarks
Vector d doesn't need to be sized before invoking this function

◆ getSignedDistance() [2/3]

virtual real_t getSignedDistance ( const Point< real_t > &  p) const
virtual

Return signed distance from a given point to current figure.

Parameters
[in]pPoint instance from which distance is computed

Reimplemented from Figure.

◆ getSignedDistance() [3/3]

real_t getSignedDistance ( const Point< real_t > &  p) const
virtual

Return signed distance of a given point from the current sphere.

The computed distance is negative if p lies in the ball, positive if it is outside, and 0 on the sphere

Parameters
[in]pPoint<double> instance

Reimplemented from Figure.

◆ operator+=() [1/2]

Sphere & operator+= ( Point< real_t >  a)

Operator +=.

Translate sphere by a vector a

◆ operator+=() [2/2]

Sphere & operator+= ( real_t  a)

Operator *=.

Scale sphere by a factor a