DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StarShaped2D.h
1 
17 #pragma once
18 
33 #if defined(StarShaped2D_RECURSES)
34 #error Recursive header files inclusion detected in StarShaped2D.h
35 #else // defined(StarShaped2D_RECURSES)
36 
37 #define StarShaped2D_RECURSES
38 
39 #if !defined StarShaped2D_h
40 
41 #define StarShaped2D_h
42 
44 // Inclusions
45 #include <iostream>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/kernel/NumberTraits.h"
49 
50 namespace DGtal
51 {
52 
54  // template class StarShaped2D
72  template <typename TSpace>
74  {
75 
76  public:
77  typedef TSpace Space;
78  typedef typename Space::Point Point;
79  typedef typename Space::RealPoint RealPoint;
80 
85  {}
86 
90  ~StarShaped2D();
91 
92  // ------------------------- Implemented services -------------------------
93  public:
97  virtual RealPoint interiorPoint() const
98  {
99  return center();
100  }
101 
102  // ------------------------- Abstract services ----------------------------
103  public:
104 
109  virtual RealPoint getLowerBound() const = 0;
110 
115  virtual RealPoint getUpperBound() const = 0;
116 
117 
121  virtual RealPoint center() const = 0;
122 
129  virtual double parameter( const RealPoint & p ) const = 0;
130 
137  virtual RealPoint x( const double t ) const = 0;
138 
145  virtual RealPoint xp( const double t ) const = 0;
146 
152  virtual RealPoint xpp( const double t ) const = 0;
153 
154 
155  // ------------------------- star-shaped services -------------------------
156  public:
157 
158 
165  bool isInside( const RealPoint & p ) const;
166 
173  bool isInside( const Point & p ) const;
174 
175 
183  Orientation orientation( const RealPoint &p) const;
184 
185 
192  RealPoint tangent( double t ) const;
193 
200  RealPoint normal( double t ) const;
201 
209  double curvature( double t ) const;
210 
217  double arclength( double t1, double t2, unsigned int nb ) const;
218 
219 
220  // ----------------------- Interface --------------------------------------
221  public:
222 
227  void selfDisplay ( std::ostream & out ) const;
228 
233  bool isValid() const;
234 
235  // ------------------------- Protected Datas ------------------------------
236  private:
237  // ------------------------- Private Datas --------------------------------
238  private:
239 
240  // ------------------------- Hidden services ------------------------------
241  protected:
242 
247  //StarShaped2D();
248 
249  private:
250 
256  //StarShaped2D ( const StarShaped2D & other );
257 
264  StarShaped2D & operator= ( const StarShaped2D & other );
265 
266  // ------------------------- Internals ------------------------------------
267  private:
268 
269  }; // end of class StarShaped2D
270 
271 
278  template <typename T>
279  std::ostream&
280  operator<< ( std::ostream & out, const StarShaped2D<T> & object );
281 
282 } // namespace DGtal
283 
284 
286 // Includes inline functions.
287 #include "DGtal/shapes/parametric/StarShaped2D.ih"
288 
289 // //
291 
292 #endif // !defined StarShaped2D_h
293 
294 #undef StarShaped2D_RECURSES
295 #endif // else defined(StarShaped2D_RECURSES)