DGtal  1.2.0
AccFlower2D.h
1 
17 #pragma once
18 
33 #if defined(AccFlower2D_RECURSES)
34 #error Recursive header files inclusion detected in AccFlower2D.h
35 #else // defined(AccFlower2D_RECURSES)
37 #define AccFlower2D_RECURSES
38 
39 #if !defined AccFlower2D_h
41 #define AccFlower2D_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 AccFlower2D
63  template <typename TSpace>
64  class AccFlower2D 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  AccFlower2D() = delete;
78 
88  AccFlower2D( 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  AccFlower2D( const AccFlower2D& other );
113 
120  AccFlower2D& operator= ( const AccFlower2D& other ) = delete;
121 
125  ~AccFlower2D() = default;
126 
127  // ------------- Implementation of 'StarShaped' services ------------------
128  public:
129 
135  {
136  return myCenter - (myRadius + myVarRadius);
137  }
138 
144  {
145  return myCenter + (myRadius + myVarRadius);
146  }
147 
152  {
153  return myCenter;
154  }
155 
160  inline
161  void moveTo( const RealPoint& newCenter )
162  {
163  myCenter = newCenter;
164  }
165 
172  double parameter( const RealPoint & p ) const;
173 
174 
181  RealPoint x( const double t ) const;
182 
189  RealVector xp( const double t ) const;
190 
196  RealVector xpp( const double t ) const;
197 
198 
199  // ------------------------- data ----------------------------
200  private:
201 
206 
210  double myRadius;
211 
215  double myVarRadius;
216 
220  unsigned int myK;
221 
225  double myKp;
226 
230  double myPhi;
231 
232  // ----------------------- Interface --------------------------------------
233  public:
234 
239  void selfDisplay ( std::ostream & out ) const;
240 
245  bool isValid() const;
246 
247  }; // end of class AccFlower2D
248 
249 
256  template <typename T>
257  std::ostream&
258  operator<< ( std::ostream & out, const AccFlower2D<T> & object );
259 
260 } // namespace DGtal
261 
262 
264 // Includes inline functions.
265 #include "DGtal/shapes/parametric/AccFlower2D.ih"
266 
267 // //
269 
270 #endif // !defined AccFlower2D_h
271 
272 #undef AccFlower2D_RECURSES
273 #endif // else defined(AccFlower2D_RECURSES)
Aim: Model of the concept StarShaped represents any accelerated flower in the plane.
Definition: AccFlower2D.h:65
RealPoint x(const double t) const
RealPoint getLowerBound() const
Definition: AccFlower2D.h:134
AccFlower2D(const double x0, const double y0, const double r, const double smallr, const unsigned int k, const double phi)
bool isValid() const
unsigned int myK
Definition: AccFlower2D.h:220
void selfDisplay(std::ostream &out) const
RealVector xp(const double t) const
RealPoint myCenter
Definition: AccFlower2D.h:205
AccFlower2D(const AccFlower2D &other)
RealPoint center() const
Definition: AccFlower2D.h:151
RealPoint getUpperBound() const
Definition: AccFlower2D.h:143
AccFlower2D(const RealPoint &aPoint, const double r, const double smallr, const unsigned int k, const double phi)
AccFlower2D & operator=(const AccFlower2D &other)=delete
Space::RealPoint RealPoint
Definition: AccFlower2D.h:70
void moveTo(const RealPoint &newCenter)
Definition: AccFlower2D.h:161
~AccFlower2D()=default
Space::RealVector RealVector
Definition: AccFlower2D.h:71
RealVector xpp(const double t) const
double parameter(const RealPoint &p) const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Z3i::RealVector RealVector
Z2i::RealPoint RealPoint
const Point aPoint(3, 4)