DGtal  1.5.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)
35 #define Ball3D_RECURSES
36 
37 #if !defined Ball3D_h
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 
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)
Aim: Model of the concept StarShaped3D represents any Sphere in the space.
Definition: Ball3D.h:61
Ball3D(const double x0, const double y0, const double z0, const double r)
Ball3D & operator=(const Ball3D &other)=delete
virtual RealPoint gradient(const AngularCoordinates &t) const
Ball3D()=delete
TSpace Space
Definition: Ball3D.h:65
std::pair< double, double > AngularCoordinates
Definition: Ball3D.h:67
double myRadius
Definition: Ball3D.h:216
RealPoint getUpperBound() const
Definition: Ball3D.h:127
RealPoint getLowerBound() const
Definition: Ball3D.h:117
AngularCoordinates parameter(const RealPoint &p) const
virtual RealPoint rtt(const AngularCoordinates &t) const
Ball3D(const Ball3D &other)
virtual RealPoint rp(const AngularCoordinates &t) const
bool isValid() const
void moveTo(const RealPoint &newCenter)
Definition: Ball3D.h:145
~Ball3D()=default
RealPoint myCenter
Definition: Ball3D.h:221
virtual RealPoint rtp(const AngularCoordinates &t) const
RealPoint center() const
Definition: Ball3D.h:135
virtual RealPoint rpp(const AngularCoordinates &t) const
void selfDisplay(std::ostream &out) const
RealPoint x(const AngularCoordinates &t) const
Space::RealPoint RealPoint
Definition: Ball3D.h:66
virtual RealPoint rt(const AngularCoordinates &t) const
Ball3D(const RealPoint &aPoint, const double r)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
const Point aPoint(3, 4)
PointVector< 3, double > RealPoint