DGtal  1.5.beta
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)
37 #define Flower2D_RECURSES
38 
39 #if !defined Flower2D_h
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 final: public StarShaped2D<TSpace>
65  {
66  // ----------------------- Standard services ------------------------------
67  public:
68 
69  typedef TSpace Space;
70  typedef typename Space::RealPoint RealPoint;
71  typedef typename Space::RealVector RealVector;
72 
77  Flower2D() = delete;
78 
88  Flower2D( const double x0, const double y0,
89  const double r,
90  const double smallr,
91  const unsigned int k,
92  const double phi );
93 
103  const double r,
104  const double smallr,
105  const unsigned int k,
106  const double phi );
107 
112  Flower2D( const Flower2D& other );
113 
120  Flower2D& operator=( const Flower2D& other ) = delete;
121 
125  ~Flower2D() = default;
126 
127 
128  // ------------- Implementation of 'StarShaped' services ------------------
129  public:
130 
136  {
137  return myCenter - (myRadius + myVarRadius);
138  }
139 
145  {
146  return myCenter + (myRadius + myVarRadius);
147  }
148 
153  {
154  return myCenter;
155  }
156 
161  inline
162  void moveTo( const RealPoint& newCenter )
163  {
164  myCenter = newCenter;
165  }
166 
173  double parameter( const RealPoint & p ) const;
174 
175 
182  RealPoint x( const double t ) const;
183 
190  RealVector xp( const double t ) const;
191 
197  RealVector xpp( const double t ) const;
198 
199 
200  // ------------------------- data ----------------------------
201  private:
202 
207 
211  double myRadius;
212 
216  double myVarRadius;
217 
221  unsigned int myK;
222 
226  double myPhi;
227 
228  // ----------------------- Interface --------------------------------------
229  public:
230 
235  void selfDisplay ( std::ostream & out ) const;
236 
241  bool isValid() const;
242 
243  }; // end of class Flower2D
244 
245 
252  template <typename T>
253  std::ostream&
254  operator<< ( std::ostream & out, const Flower2D<T> & object );
255 
256 } // namespace DGtal
257 
258 
260 // Includes inline functions.
261 #include "DGtal/shapes/parametric/Flower2D.ih"
262 
263 // //
265 
266 #endif // !defined Flower2D_h
267 
268 #undef Flower2D_RECURSES
269 #endif // else defined(Flower2D_RECURSES)
Aim: Model of the concept StarShaped represents any flower with k-petals in the plane.
Definition: Flower2D.h:65
RealPoint center() const
Definition: Flower2D.h:152
RealPoint myCenter
Definition: Flower2D.h:206
RealVector xpp(const double t) const
RealPoint getLowerBound() const
Definition: Flower2D.h:135
Flower2D(const double x0, const double y0, const double r, const double smallr, const unsigned int k, const double phi)
Space::RealPoint RealPoint
Definition: Flower2D.h:70
~Flower2D()=default
TSpace Space
Definition: Flower2D.h:69
double myPhi
Definition: Flower2D.h:226
Flower2D(const Flower2D &other)
void selfDisplay(std::ostream &out) const
RealVector xp(const double t) const
RealPoint getUpperBound() const
Definition: Flower2D.h:144
double myRadius
Definition: Flower2D.h:211
Flower2D(const RealPoint &aPoint, const double r, const double smallr, const unsigned int k, const double phi)
Flower2D()=delete
Space::RealVector RealVector
Definition: Flower2D.h:71
unsigned int myK
Definition: Flower2D.h:221
Flower2D & operator=(const Flower2D &other)=delete
double myVarRadius
Definition: Flower2D.h:216
RealPoint x(const double t) const
void moveTo(const RealPoint &newCenter)
Definition: Flower2D.h:162
bool isValid() const
double parameter(const RealPoint &p) const
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
PolygonalCalculus< SH3::RealPoint, SH3::RealVector >::Vector phi(const Face f)
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