DGtal  1.3.beta
StarShaped3D.h
1 
17 #pragma once
18 
31 #if defined(StarShaped3D_RECURSES)
32 #error Recursive header files inclusion detected in StarShaped3D.h
33 #else // defined(StarShaped3D_RECURSES)
34 
35 #define StarShaped3D_RECURSES
36 
37 #if !defined StarShaped3D_h
38 
39 #define StarShaped3D_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/kernel/NumberTraits.h"
47 
48 namespace DGtal
49 {
50 
52  // template class StarShaped3D
70  template <typename TSpace>
72  {
73 
74  public:
75  typedef TSpace Space;
76  typedef typename Space::RealPoint RealPoint;
77  typedef std::pair<double,double> AngularCoordinates;
78 
82  StarShaped3D() = default;
83 
90  StarShaped3D & operator= ( const StarShaped3D & other ) = delete;
91 
95  virtual ~StarShaped3D() = default;
96 
97  // ------------------------- Implemented services -------------------------
98  public:
102  virtual RealPoint interiorPoint() const
103  {
104  return center();
105  }
106 
107  // ------------------------- Abstract services ----------------------------
108  public:
109 
114  virtual RealPoint getLowerBound() const = 0;
115 
120  virtual RealPoint getUpperBound() const = 0;
121 
125  virtual RealPoint center() const = 0;
126 
131  virtual void moveTo( const RealPoint& newCenter ) = 0;
132 
139  virtual AngularCoordinates parameter( const RealPoint& p ) const = 0;
140 
148  virtual RealPoint x( const AngularCoordinates& t ) const = 0;
149 
156  virtual RealPoint gradient( const AngularCoordinates& t ) const = 0;
157 
164  virtual RealPoint rt( const AngularCoordinates& t ) const = 0;
165 
172  virtual RealPoint rp( const AngularCoordinates& t ) const = 0;
173 
181  virtual RealPoint rtt( const AngularCoordinates& t ) const = 0;
182 
190  virtual RealPoint rpp( const AngularCoordinates& t ) const = 0;
191 
199  virtual RealPoint rtp( const AngularCoordinates& t ) const = 0;
200 
201  // ------------------------- star-shaped services -------------------------
202  public:
203 
211  virtual Orientation orientation( const RealPoint& p ) const;
212 
213  /*
214  * @param t is a couple of Teta && Phi wich are 2 angles
215  respectivly between [0,2PI] and [0,Pi].
216  *
217  * @return the vector (x'(t),y'(t),z'(t)) made unitary which is
218  * the unit tangent to the shape boundary.
219  */
220  /*
221  virtual RealPoint tangent( AngularCoordinates t ) const;
222  */
223 
231  virtual RealPoint normal( const AngularCoordinates& t ) const;
232 
241  virtual double gaussianCurvature( const AngularCoordinates& t ) const;
242 
243 
252  virtual double meanCurvature( const AngularCoordinates& t ) const;
253 
254 
265  virtual double arclength( const AngularCoordinates& t1,
267  unsigned int nb ) const;
268 
269 
280  virtual double surfacelength( const AngularCoordinates& t1,
282  unsigned int nb ) const;
283 
284 
285 
286  // ----------------------- Interface --------------------------------------
287  public:
288 
293  void selfDisplay( std::ostream & out ) const;
294 
299  bool isValid() const;
300 
301  // ------------------------- Hidden services ------------------------------
302  private:
303 
307  template <typename T>
308  inline
309  bool isAlmostEqual( T x, T y ) const
310  {
311  return std::abs(x - y) <= std::numeric_limits<T>::epsilon();
312  }
313 
314  }; // end of class StarShaped3D
315 
316 
323  template <typename T>
324  std::ostream&
325  operator<< ( std::ostream & out, const StarShaped3D<T> & object );
326 
327 } // namespace DGtal
328 
329 
331 // Includes inline functions.
332 #include "StarShaped3D.ih"
333 
334 // //
336 
337 #endif // !defined StarShaped3D_h
338 
339 #undef StarShaped3D_RECURSES
340 #endif // else defined(StarShaped3D_RECURSES)
DGtal::StarShaped3D::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::StarShaped3D::isValid
bool isValid() const
DGtal::StarShaped3D::gaussianCurvature
virtual double gaussianCurvature(const AngularCoordinates &t) const
DGtal::StarShaped3D::moveTo
virtual void moveTo(const RealPoint &newCenter)=0
DGtal::StarShaped3D::rtp
virtual RealPoint rtp(const AngularCoordinates &t) const =0
DGtal::StarShaped3D::parameter
virtual AngularCoordinates parameter(const RealPoint &p) const =0
DGtal::StarShaped3D::interiorPoint
virtual RealPoint interiorPoint() const
Definition: StarShaped3D.h:102
DGtal::StarShaped3D::surfacelength
virtual double surfacelength(const AngularCoordinates &t1, AngularCoordinates t2, unsigned int nb) const
DGtal::StarShaped3D::x
virtual RealPoint x(const AngularCoordinates &t) const =0
DGtal::StarShaped3D::rt
virtual RealPoint rt(const AngularCoordinates &t) const =0
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::Orientation
Orientation
Definition: Common.h:142
DGtal::StarShaped3D::rpp
virtual RealPoint rpp(const AngularCoordinates &t) const =0
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::StarShaped3D::~StarShaped3D
virtual ~StarShaped3D()=default
DGtal::StarShaped3D::meanCurvature
virtual double meanCurvature(const AngularCoordinates &t) const
DGtal::StarShaped3D::StarShaped3D
StarShaped3D()=default
DGtal::StarShaped3D::AngularCoordinates
std::pair< double, double > AngularCoordinates
Definition: StarShaped3D.h:77
DGtal::StarShaped3D::Space
TSpace Space
Definition: StarShaped3D.h:75
DGtal::StarShaped3D::RealPoint
Space::RealPoint RealPoint
Definition: StarShaped3D.h:76
DGtal::StarShaped3D::isAlmostEqual
bool isAlmostEqual(T x, T y) const
Definition: StarShaped3D.h:309
DGtal::StarShaped3D::arclength
virtual double arclength(const AngularCoordinates &t1, AngularCoordinates t2, unsigned int nb) const
DGtal::StarShaped3D
Definition: StarShaped3D.h:71
DGtal::StarShaped3D::gradient
virtual RealPoint gradient(const AngularCoordinates &t) const =0
DGtal::SpaceND::RealPoint
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
DGtal::StarShaped3D::rp
virtual RealPoint rp(const AngularCoordinates &t) const =0
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::StarShaped3D::center
virtual RealPoint center() const =0
DGtal::StarShaped3D::getLowerBound
virtual RealPoint getLowerBound() const =0
DGtal::StarShaped3D::operator=
StarShaped3D & operator=(const StarShaped3D &other)=delete
DGtal::StarShaped3D::getUpperBound
virtual RealPoint getUpperBound() const =0
DGtal::StarShaped3D::normal
virtual RealPoint normal(const AngularCoordinates &t) const
DGtal::StarShaped3D::rtt
virtual RealPoint rtt(const AngularCoordinates &t) const =0
DGtal::StarShaped3D::orientation
virtual Orientation orientation(const RealPoint &p) const