DGtal  1.3.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)
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 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 
102  Flower2D( const RealPoint& aPoint,
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)
DGtal::Flower2D::RealVector
Space::RealVector RealVector
Definition: Flower2D.h:71
DGtal::Flower2D::RealPoint
Space::RealPoint RealPoint
Definition: Flower2D.h:70
DGtal::Flower2D::myRadius
double myRadius
Definition: Flower2D.h:211
DGtal::Flower2D::myVarRadius
double myVarRadius
Definition: Flower2D.h:216
DGtal::Flower2D::center
RealPoint center() const
Definition: Flower2D.h:152
aPoint
const Point aPoint(3, 4)
DGtal::StarShaped2D
Definition: StarShaped2D.h:74
DGtal::Flower2D::parameter
double parameter(const RealPoint &p) const
DGtal::Flower2D::xpp
RealVector xpp(const double t) const
DGtal::Flower2D::xp
RealVector xp(const double t) const
DGtal::Flower2D::myCenter
RealPoint myCenter
Definition: Flower2D.h:206
DGtal::Flower2D::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::Flower2D::myPhi
double myPhi
Definition: Flower2D.h:226
DGtal::Flower2D::getUpperBound
RealPoint getUpperBound() const
Definition: Flower2D.h:144
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::Flower2D::x
RealPoint x(const double t) const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::Flower2D::Space
TSpace Space
Definition: Flower2D.h:69
DGtal::Flower2D::Flower2D
Flower2D()=delete
DGtal::Flower2D::moveTo
void moveTo(const RealPoint &newCenter)
Definition: Flower2D.h:162
DGtal::Flower2D::isValid
bool isValid() const
DGtal::SpaceND::RealPoint
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
DGtal::Flower2D::myK
unsigned int myK
Definition: Flower2D.h:221
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::Flower2D::getLowerBound
RealPoint getLowerBound() const
Definition: Flower2D.h:135
DGtal::Flower2D::operator=
Flower2D & operator=(const Flower2D &other)=delete
DGtal::Flower2D
Aim: Model of the concept StarShaped represents any flower with k-petals in the plane.
Definition: Flower2D.h:64
DGtal::Flower2D::~Flower2D
~Flower2D()=default