DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Flower2D.h
1 
17 #pragma once
18 
33 #if defined(Flower2D_RECURSES)
34 #error Recursive header files inclusion detected in Flower2D.h
35 #else // defined(Flower2D_RECURSES)
36 
37 #define Flower2D_RECURSES
38 
39 #if !defined Flower2D_h
40 
41 #define Flower2D_h
42 
44 // Inclusions
45 #include <iostream>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/shapes/parametric/StarShaped2D.h"
48 #include <cmath>
50 
51 namespace DGtal
52 {
53 
55  // template class Flower2D
63  template <typename TSpace>
64  class Flower2D: public StarShaped2D<TSpace>
65  {
66  // ----------------------- Standard services ------------------------------
67  public:
68 
69  typedef TSpace Space;
70  typedef typename Space::Point Point;
71  typedef typename Space::RealPoint RealPoint2D;
72  typedef typename Space::RealVector RealVector2D;
76  ~Flower2D();
77 
87  Flower2D( const double x0, const double y0,
88  const double r,
89  const double smallr,
90  const unsigned int k,
91  const double phi);
92 
101  Flower2D(const RealPoint2D &aPoint,
102  const double r,
103  const double smallr,
104  const unsigned int k,
105  const double phi);
106 
115  Flower2D(const Point &aPoint,
116  const double r,
117  const double smallr,
118  const unsigned int k,
119  const double phi);
120 
121 
122  // ------------- Implementation of 'StarShaped' services ------------------
123  public:
124 
130  {
132  }
133 
139  {
141  }
142 
147  {
148  return myCenter;
149  }
150 
157  double parameter( const RealPoint2D & p ) const;
158 
159 
166  RealPoint2D x( const double t ) const;
167 
174  RealVector2D xp( const double t ) const;
175 
181  RealVector2D xpp( const double t ) const;
182 
183 
184  // ------------------------- data ----------------------------
185  private:
186 
191 
195  double myRadius;
196 
200  double myVarRadius;
201 
205  unsigned int myK;
206 
210  double myPhi;
211 
212  // ----------------------- Interface --------------------------------------
213  public:
214 
219  void selfDisplay ( std::ostream & out ) const;
220 
225  bool isValid() const;
226 
227 
228  // ------------------------- Hidden services ------------------------------
229  protected:
230 
235  Flower2D();
236 
237  private:
238 
244  // Flower2D ( const Flower2D & other );
245 
252  Flower2D & operator= ( const Flower2D & other );
253 
254  // ------------------------- Internals ------------------------------------
255  private:
256 
257  }; // end of class Flower2D
258 
259 
266  template <typename T>
267  std::ostream&
268  operator<< ( std::ostream & out, const Flower2D<T> & object );
269 
270 } // namespace DGtal
271 
272 
274 // Includes inline functions.
275 #include "DGtal/shapes/parametric/Flower2D.ih"
276 
277 // //
279 
280 #endif // !defined Flower2D_h
281 
282 #undef Flower2D_RECURSES
283 #endif // else defined(Flower2D_RECURSES)