DGtal  0.9.2
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 
129  RealPoint2D getLowerBound() const
130  {
132  }
133 
138  RealPoint2D getUpperBound() const
139  {
141  }
142 
146  RealPoint2D center() const
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 
190  RealPoint2D myCenter;
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)
Space::Point Point
Definition: Flower2D.h:70
RealPoint2D center() const
Definition: Flower2D.h:146
double myRadius
Definition: Flower2D.h:195
double myVarRadius
Definition: Flower2D.h:200
Flower2D & operator=(const Flower2D &other)
RealVector2D xp(const double t) const
RealPoint2D x(const double t) const
double myPhi
Definition: Flower2D.h:210
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
RealPoint2D getLowerBound() const
Definition: Flower2D.h:129
Aim: Model of the concept StarShaped represents any flower with k-petals in the plane.
Definition: Flower2D.h:64
void selfDisplay(std::ostream &out) const
RealPoint2D getUpperBound() const
Definition: Flower2D.h:138
TSpace Space
Definition: Flower2D.h:69
DGtal is the top-level namespace which contains all DGtal functions and types.
bool isValid() const
Space::RealVector RealVector2D
Definition: Flower2D.h:72
unsigned int myK
Definition: Flower2D.h:205
double parameter(const RealPoint2D &p) const
Space::RealPoint RealPoint2D
Definition: Flower2D.h:71
RealPoint2D myCenter
Definition: Flower2D.h:190
RealVector2D xpp(const double t) const