DGtal  1.3.beta
Ball3D.h
1 
17 #pragma once
18 
31 #if defined(Ball3D_RECURSES)
32 #error Recursive header files inclusion detected in Ball3D.h
33 #else // defined(Ball3D_RECURSES)
34 
35 #define Ball3D_RECURSES
36 
37 #if !defined Ball3D_h
38 
39 #define Ball3D_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "StarShaped3D.h"
47 
48 namespace DGtal
49 {
50 
52  // template class Ball3D
59  template <typename TSpace>
60  class Ball3D final: public StarShaped3D<TSpace>
61  {
62  // ----------------------- Standard services ------------------------------
63  public:
64 
65  typedef TSpace Space;
66  typedef typename Space::RealPoint RealPoint;
67  typedef std::pair<double,double> AngularCoordinates;
68 
73  Ball3D() = delete;
74 
82  Ball3D( const double x0, const double y0, const double z0, const double r );
83 
89  Ball3D( const RealPoint& aPoint, const double r );
90 
95  Ball3D( const Ball3D& other );
96 
103  Ball3D& operator=( const Ball3D& other ) = delete;
104 
108  ~Ball3D() = default;
109 
110  // ------------- Implementation of 'StarShaped' services ------------------
111  public:
112 
118  {
119 
120  return myCenter - myRadius;
121  }
122 
128  {
129  return myCenter + myRadius;
130  }
131 
136  {
137  return myCenter;
138  }
139 
144  inline
145  void moveTo( const RealPoint& newCenter )
146  {
147  myCenter = newCenter;
148  }
149 
157  AngularCoordinates parameter( const RealPoint & p ) const;
158 
165  RealPoint x( const AngularCoordinates& t ) const;
166 
172  virtual RealPoint gradient( const AngularCoordinates& t) const ;
173 
179  virtual RealPoint rt( const AngularCoordinates& t) const ;
180 
186  virtual RealPoint rp( const AngularCoordinates& t) const ;
187 
193  virtual RealPoint rtt( const AngularCoordinates& t) const ;
194 
200  virtual RealPoint rpp( const AngularCoordinates& t) const ;
201 
207  virtual RealPoint rtp( const AngularCoordinates& t) const ;
208 
209 
210  // ------------------------- data ----------------------------
211  private:
212 
216  double myRadius;
217 
222 
223  // ----------------------- Interface --------------------------------------
224  public:
225 
230  void selfDisplay ( std::ostream & out ) const;
231 
236  bool isValid() const;
237 
238  }; // end of class Ball3D
239 
240 
247  template <typename T>
248  std::ostream&
249  operator<< ( std::ostream & out, const Ball3D<T> & object );
250 
251 } // namespace DGtal
252 
253 
255 // Includes inline functions.
256 #include "Ball3D.ih"
257 
258 // //
260 
261 #endif // !defined Ball3D_h
262 
263 #undef Ball3D_RECURSES
264 #endif // else defined(Ball3D_RECURSES)
DGtal::Ball3D::Space
TSpace Space
Definition: Ball3D.h:65
DGtal::Ball3D::gradient
virtual RealPoint gradient(const AngularCoordinates &t) const
DGtal::Ball3D::operator=
Ball3D & operator=(const Ball3D &other)=delete
aPoint
const Point aPoint(3, 4)
DGtal::Ball3D::myCenter
RealPoint myCenter
Definition: Ball3D.h:221
DGtal::Ball3D::getUpperBound
RealPoint getUpperBound() const
Definition: Ball3D.h:127
DGtal::Ball3D::AngularCoordinates
std::pair< double, double > AngularCoordinates
Definition: Ball3D.h:67
DGtal::Ball3D::moveTo
void moveTo(const RealPoint &newCenter)
Definition: Ball3D.h:145
DGtal::Ball3D::rp
virtual RealPoint rp(const AngularCoordinates &t) const
DGtal::Ball3D::Ball3D
Ball3D()=delete
DGtal::Ball3D::~Ball3D
~Ball3D()=default
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::Ball3D::center
RealPoint center() const
Definition: Ball3D.h:135
DGtal::Ball3D::myRadius
double myRadius
Definition: Ball3D.h:216
DGtal::Ball3D::rpp
virtual RealPoint rpp(const AngularCoordinates &t) const
DGtal::Ball3D::isValid
bool isValid() const
DGtal::Ball3D::x
RealPoint x(const AngularCoordinates &t) const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::Ball3D::RealPoint
Space::RealPoint RealPoint
Definition: Ball3D.h:66
DGtal::Ball3D::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::Ball3D::rt
virtual RealPoint rt(const AngularCoordinates &t) const
DGtal::Ball3D::rtt
virtual RealPoint rtt(const AngularCoordinates &t) const
DGtal::StarShaped3D
Definition: StarShaped3D.h:71
DGtal::SpaceND::RealPoint
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::Ball3D::parameter
AngularCoordinates parameter(const RealPoint &p) const
DGtal::Ball3D::getLowerBound
RealPoint getLowerBound() const
Definition: Ball3D.h:117
DGtal::Ball3D::rtp
virtual RealPoint rtp(const AngularCoordinates &t) const
DGtal::Ball3D
Aim: Model of the concept StarShaped3D represents any Sphere in the space.
Definition: Ball3D.h:60