DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DGtal::Ball3D< TSpace > Class Template Reference

#include <Ball3D.h>

Inheritance diagram for DGtal::Ball3D< TSpace >:
Inheritance graph
[legend]
Collaboration diagram for DGtal::Ball3D< TSpace >:
Collaboration graph
[legend]

Public Types

typedef TSpace Space
typedef Space::RealPoint RealPoint
typedef pair< double, double > AngularCoordinates
- Public Types inherited from DGtal::StarShaped3D< TSpace >

Public Member Functions

 ~Ball3D ()
 Ball3D (const double x0, const double y0, const double z0, const double r)
 Ball3D (const RealPoint &aPoint, const double r)
RealPoint getLowerBound () const
RealPoint getUpperBound () const
RealPoint center () const
AngularCoordinates parameter (const RealPoint &p) const
RealPoint x (const AngularCoordinates t) const
virtual RealPoint gradient (const AngularCoordinates t) const
virtual RealPoint rt (const AngularCoordinates t) const
virtual RealPoint rp (const AngularCoordinates t) const
virtual RealPoint rtt (const AngularCoordinates t) const
virtual RealPoint rpp (const AngularCoordinates t) const
virtual RealPoint rtp (const AngularCoordinates t) const
void selfDisplay (std::ostream &out) const
bool isValid () const
- Public Member Functions inherited from DGtal::StarShaped3D< TSpace >
 StarShaped3D ()
 ~StarShaped3D ()
virtual RealPoint interiorPoint () const
virtual bool isInside (const RealPoint &p) const
virtual Orientation orientation (const RealPoint &p) const
virtual RealPoint normal (AngularCoordinates t) const
virtual double gaussianCurvature (AngularCoordinates t) const
virtual double meanCurvature (AngularCoordinates t) const
virtual double arclength (AngularCoordinates t1, AngularCoordinates t2, unsigned int nb) const
virtual double surfacelength (AngularCoordinates t1, AngularCoordinates t2, unsigned int nb) const

Protected Member Functions

 Ball3D ()

Private Member Functions

Ball3Doperator= (const Ball3D &other)

Private Attributes

double myRadius
RealPoint myCenter

Detailed Description

template<typename TSpace>
class DGtal::Ball3D< TSpace >

Aim: Model of the concept StarShaped3D represents any Sphere in the space.

Description of template class 'Ball3D'

Definition at line 60 of file Ball3D.h.


Member Typedef Documentation

template<typename TSpace>
typedef pair<double,double> DGtal::Ball3D< TSpace >::AngularCoordinates

Reimplemented from DGtal::StarShaped3D< TSpace >.

Definition at line 67 of file Ball3D.h.

template<typename TSpace>
typedef Space::RealPoint DGtal::Ball3D< TSpace >::RealPoint

Reimplemented from DGtal::StarShaped3D< TSpace >.

Definition at line 66 of file Ball3D.h.

template<typename TSpace>
typedef TSpace DGtal::Ball3D< TSpace >::Space

Reimplemented from DGtal::StarShaped3D< TSpace >.

Definition at line 65 of file Ball3D.h.


Constructor & Destructor Documentation

template<typename T >
DGtal::Ball3D< T >::~Ball3D ( )
inline

Destructor.

Definition at line 49 of file Ball3D.ih.

{
}
template<typename T >
DGtal::Ball3D< T >::Ball3D ( const double  x0,
const double  y0,
const double  z0,
const double  r 
)
inline

Constructor.

Parameters:
x0the x-coordinate of the sphere center.
y0the y-coordinate of the sphere center.
y0the y-coordinate of the sphere center.
rthe radius of the sphere.

Definition at line 55 of file Ball3D.ih.

:
myRadius(radius), myCenter(x0,y0,z0)
{}
template<typename T >
DGtal::Ball3D< T >::Ball3D ( const RealPoint aPoint,
const double  r 
)
inline

Constructor.

Parameters:
aPointthe sphere center.
rthe radius of the sphere.

Definition at line 62 of file Ball3D.ih.

:
myRadius(radius), myCenter(aPoint)
{}
template<typename TSpace>
DGtal::Ball3D< TSpace >::Ball3D ( )
protected

Constructor. Forbidden by default (protected to avoid g++ warnings).


Member Function Documentation

template<typename TSpace>
RealPoint DGtal::Ball3D< TSpace >::center ( ) const
inlinevirtual
Returns:
the center of the sphere.

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 129 of file Ball3D.h.

References DGtal::Ball3D< TSpace >::myCenter.

{
return myCenter;
}
template<typename TSpace>
RealPoint DGtal::Ball3D< TSpace >::getLowerBound ( ) const
inlinevirtual

Constructor.

Parameters:
aPointthe sphere center.
rthe radius of the sphere.
Returns:
the lower bound of the sphere.

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 107 of file Ball3D.h.

References DGtal::Ball3D< TSpace >::myCenter, and DGtal::Ball3D< TSpace >::myRadius.

{
}
template<typename TSpace>
RealPoint DGtal::Ball3D< TSpace >::getUpperBound ( ) const
inlinevirtual
Returns:
the upper bound of the sphere.

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 119 of file Ball3D.h.

References DGtal::Ball3D< TSpace >::myCenter, and DGtal::Ball3D< TSpace >::myRadius.

{
return RealPoint(myCenter[0] + myRadius ,
}
template<typename T >
DGtal::Ball3D< T >::RealPoint DGtal::Ball3D< T >::gradient ( const AngularCoordinates  t) const
inlinevirtual
Parameters:
tis a couple of Teta && Phi wich are respectivly between [-Pi/2,Pi/2) and [-Pi,Pi].
Returns:
the vector (gradf(M)).
Parameters:
tis a couple of Teta && Phi wich are angles respectivly betweend [0,2PI] and [0,Pi].
Returns:
the vector (gradf(M)).

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 132 of file Ball3D.ih.

{
RealPoint p= x(t);
double xx=2*(p[0]-myCenter[0]);
double yy =2*(p[1]-myCenter[1]);
double zz=2*(p[2]-myCenter[2]);
return RealPoint(xx,yy,zz);
}
template<typename T >
bool DGtal::Ball3D< T >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Reimplemented from DGtal::StarShaped3D< TSpace >.

Definition at line 236 of file Ball3D.ih.

{
return true;
}
template<typename TSpace>
Ball3D& DGtal::Ball3D< TSpace >::operator= ( const Ball3D< TSpace > &  other)
private

Copy constructor.

Parameters:
otherthe object to clone. Forbidden by default. Assignment.
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename T >
AngularCoordinates DGtal::Ball3D< T >::parameter ( const RealPoint pp) const
inlinevirtual
Parameters:
pany point in the space.
Returns:
the couple of angles parameters Teta && Phi wich are respectivly between [-Pi/2,Pi/2) and [-Pi,Pi] corresponding to this point for the shape.
Parameters:
pany point in the plane.
Returns:
the couple of angle parameters (Teta,Phi) respectivly between [0,2PI] and [0,Pi] corresponding to this point for the shape.

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 79 of file Ball3D.ih.

References M_PI.

{
RealPoint l( pp );
l -= myCenter;
AngularCoordinates angle ;
if((fabs(l[0])<0.0001)&&(fabs(l[1])<0.0001))
{
angle.first=0;
if(l[2]>=0)
angle.second=0;
if(l[2]<0)
angle.second=M_PI;
}
else
{
if(l[1]>0)
angle.first=atan2(l[1],l[0]);
else
angle.first=atan2(l[1],l[0])+M_PI*2.0;
angle.second=acos(sqrt(l[2]*l[2])/sqrt(l[0]*l[0]+l[1]*l[1]+l[2]*l[2]));
}
return angle;
}
template<typename T >
DGtal::Ball3D< T >::RealPoint DGtal::Ball3D< T >::rp ( const AngularCoordinates  t) const
inlinevirtual
Parameters:
tis a couple of Teta && Phi wich are respectivly between [-Pi/2,Pi/2) and [-Pi,Pi].
Returns:
the vector (rp(M)) wich is the partial derivative with respect to Phi.
Parameters:
tis a couple of Teta && Phi wich are angles respectivly betweend [-Pi/2,Pi/2) and [-Pi,Pi].
Returns:
the vector (rp(M)) wich is the first partial derivative with respect to Phi.

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 164 of file Ball3D.ih.

{
return RealPoint(myRadius*cos(t.first)*cos(t.second),myRadius*sin(t.first)*cos(t.second),-myRadius*sin(t.second));
}
template<typename T >
DGtal::Ball3D< T >::RealPoint DGtal::Ball3D< T >::rpp ( const AngularCoordinates  t) const
inlinevirtual
Parameters:
tis a couple of Teta && Phi wich are respectivly between [-Pi/2,Pi/2) and [-Pi,Pi].
Returns:
the vector (rpp(M)) wich is second the partial derivatif with respect to Phi (twice).
Parameters:
tis a couple of Teta && Phi wich are angles respectivly betweend [0,2PI] and [0,Pi].
Returns:
the vector (rpp(M)) wich is second the partial derivatif with respect to Phi(twice).

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 193 of file Ball3D.ih.

{
return RealPoint(-myRadius*cos(t.first)*sin(t.second),-myRadius*sin(t.first)*sin(t.second),-myRadius*cos(t.second));
}
template<typename T >
DGtal::Ball3D< T >::RealPoint DGtal::Ball3D< T >::rt ( const AngularCoordinates  t) const
inlinevirtual
Parameters:
tis a couple of Teta && Phi wich are respectivly between [-Pi/2,Pi/2) and [-Pi,Pi].
Returns:
the vector (rt(M)) wich is the partial derivative with respect to Teta.
Parameters:
tis a couple of Teta && Phi wich are angles respectivly betweend [0,2PI] and [0,Pi].
Returns:
the vector (rt(M)) wich is the first partial derivative with respect to Teta.

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 149 of file Ball3D.ih.

{
return RealPoint(-myRadius*sin(t.first)*sin(t.second),myRadius*cos(t.first)*sin(t.second),0);
}
template<typename T >
DGtal::Ball3D< T >::RealPoint DGtal::Ball3D< T >::rtp ( const AngularCoordinates  t) const
inlinevirtual
Parameters:
tis a couple of Teta && Phi wich are respectivly between [-Pi/2,Pi/2) and [-Pi,Pi].
Returns:
the vector (rpp(M)) wich is second the partial derivative with respect to Teta then Phi.
Parameters:
tis a couple of Teta && Phi wich are angles respectivly betweend [0,2PI] and [0,Pi]
Returns:
the vector (rtp(M)) wich is second the partial derivatif with respect to Teta then Phi.

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 206 of file Ball3D.ih.

{
return RealPoint(-myRadius*sin(t.first)*cos(t.second),myRadius*cos(t.first)*cos(t.second),0);
}
template<typename T >
DGtal::Ball3D< T >::RealPoint DGtal::Ball3D< T >::rtt ( const AngularCoordinates  t) const
inlinevirtual
Parameters:
tis a couple of Teta && Phi wich are respectivly between [-Pi/2,Pi/2) and [-Pi,Pi].
Returns:
the vector (rtt(M)) wich is second the partial derivative with respect to Teta (twice).
Parameters:
tis a couple of Teta && Phi wich are angles respectivly betweend [0,2PI] and [0,Pi].
Returns:
the vector (rtt(M)) wich is second the second partial derivative with respect to Teta(twice).

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 178 of file Ball3D.ih.

{
return RealPoint(-myRadius*cos(t.first)*sin(t.second),-myRadius*sin(t.first)*sin(t.second),0);
}
template<typename T >
void DGtal::Ball3D< T >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Reimplemented from DGtal::StarShaped3D< TSpace >.

Definition at line 224 of file Ball3D.ih.

{
out << "[Ball3D] center= "<<myCenter<<" radius="<<myRadius;
}
template<typename T >
DGtal::Ball3D< T >::RealPoint DGtal::Ball3D< T >::x ( const AngularCoordinates  t) const
inlinevirtual
Parameters:
tis a couple of Teta && Phi wich are respectivly between [-Pi/2,Pi/2) and [-Pi,Pi].
Returns:
the vector (x(t),y(t),z(t)) which is the position on the shape boundary.
Parameters:
tany angle between 0 and 2*Pi.
Returns:
the vector (x(t),y(t),z(t)) which is the position on the shape boundary.

Implements DGtal::StarShaped3D< TSpace >.

Definition at line 115 of file Ball3D.ih.

{
RealPoint c( myRadius*cos(t.first)*sin(t.second), myRadius*sin(t.first)*sin(t.second) , myRadius*cos(t.second));
c += myCenter;
return c;
}

Field Documentation

template<typename TSpace>
RealPoint DGtal::Ball3D< TSpace >::myCenter
private

Center of the sphere.

Definition at line 220 of file Ball3D.h.

Referenced by DGtal::Ball3D< TSpace >::center(), DGtal::Ball3D< TSpace >::getLowerBound(), and DGtal::Ball3D< TSpace >::getUpperBound().

template<typename TSpace>
double DGtal::Ball3D< TSpace >::myRadius
private

Radius of the sphere.

Definition at line 215 of file Ball3D.h.

Referenced by DGtal::Ball3D< TSpace >::getLowerBound(), and DGtal::Ball3D< TSpace >::getUpperBound().


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