DGtal  1.1.0
NGon2D.h
1 
17 #pragma once
18 
33 #if defined(NGon2D_RECURSES)
34 #error Recursive header files inclusion detected in NGon2D.h
35 #else // defined(NGon2D_RECURSES)
36 
37 #define NGon2D_RECURSES
38 
39 #if !defined NGon2D_h
40 
41 #define NGon2D_h
42 
44 // Inclusions
45 #include <iostream>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/shapes/parametric/StarShaped2D.h"
49 
50 namespace DGtal
51 {
52 
54  // template class NGon2D
62  template <typename TSpace>
63  class NGon2D final: public StarShaped2D<TSpace>
64  {
65  // ----------------------- Standard services ------------------------------
66  public:
67 
68  typedef TSpace Space;
69  typedef typename Space::RealPoint RealPoint;
70  typedef typename Space::RealVector RealVector;
71 
76  NGon2D() = delete;
77 
86  NGon2D( const double x0, const double y0, const double r ,
87  const unsigned int k, const double phi );
88 
96  NGon2D( const RealPoint& aPoint, const double r,
97  const unsigned int k, const double phi );
98 
103  NGon2D( const NGon2D& other );
104 
111  NGon2D& operator= ( const NGon2D& other ) = delete;
112 
116  ~NGon2D() = default;
117 
118 
119  // ------------- Implementation of 'StarShaped' services ------------------
120  public:
121 
127  {
128  return myCenter - myRadius;
129  }
130 
136  {
137  return myCenter + myRadius;
138  }
139 
144  {
145  return myCenter;
146  }
147 
152  inline
153  void moveTo( const RealPoint& newCenter )
154  {
155  myCenter = newCenter;
156  }
157 
164  double parameter( const RealPoint & p ) const;
165 
166 
173  RealPoint x( const double t ) const;
174 
181  RealVector xp( const double t ) const;
182 
188  RealVector xpp( const double t ) const;
189 
190 
191  // ------------------------- data ----------------------------
192  private:
193 
198 
202  double myRadius;
203 
207  unsigned int myK;
208 
212  double myPhi;
213 
214 
215 
216  // ----------------------- Interface --------------------------------------
217  public:
218 
223  void selfDisplay ( std::ostream & out ) const;
224 
229  bool isValid() const;
230 
231  }; // end of class NGon2D
232 
233 
240  template <typename T>
241  std::ostream&
242  operator<< ( std::ostream & out, const NGon2D<T> & object );
243 
244 } // namespace DGtal
245 
246 
248 // Includes inline functions.
249 #include "DGtal/shapes/parametric/NGon2D.ih"
250 
251 // //
253 
254 #endif // !defined NGon2D_h
255 
256 #undef NGon2D_RECURSES
257 #endif // else defined(NGon2D_RECURSES)
DGtal::NGon2D::NGon2D
NGon2D()=delete
DGtal::NGon2D::getLowerBound
RealPoint getLowerBound() const
Definition: NGon2D.h:126
DGtal::NGon2D::operator=
NGon2D & operator=(const NGon2D &other)=delete
DGtal::NGon2D::NGon2D
NGon2D(const double x0, const double y0, const double r, const unsigned int k, const double phi)
DGtal::NGon2D::x
RealPoint x(const double t) const
DGtal::NGon2D::isValid
bool isValid() const
aPoint
const Point aPoint(3, 4)
DGtal::NGon2D::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::StarShaped2D
Definition: StarShaped2D.h:75
DGtal::NGon2D::myRadius
double myRadius
Definition: NGon2D.h:202
DGtal::NGon2D::NGon2D
NGon2D(const NGon2D &other)
DGtal::NGon2D::moveTo
void moveTo(const RealPoint &newCenter)
Definition: NGon2D.h:153
DGtal::NGon2D
Aim: Model of the concept StarShaped represents any regular k-gon in the plane.
Definition: NGon2D.h:64
DGtal::NGon2D::getUpperBound
RealPoint getUpperBound() const
Definition: NGon2D.h:135
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::NGon2D::xpp
RealVector xpp(const double t) const
DGtal::NGon2D::parameter
double parameter(const RealPoint &p) const
DGtal::NGon2D::myK
unsigned int myK
Definition: NGon2D.h:207
DGtal::NGon2D::myCenter
RealPoint myCenter
Definition: NGon2D.h:197
DGtal::NGon2D::RealPoint
Space::RealPoint RealPoint
Definition: NGon2D.h:69
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::NGon2D::myPhi
double myPhi
Definition: NGon2D.h:212
DGtal::NGon2D::NGon2D
NGon2D(const RealPoint &aPoint, const double r, const unsigned int k, const double phi)
DGtal::NGon2D::RealVector
Space::RealVector RealVector
Definition: NGon2D.h:70
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
DGtal::NGon2D::xp
RealVector xp(const double t) const
DGtal::NGon2D::Space
TSpace Space
Definition: NGon2D.h:68
DGtal::NGon2D::~NGon2D
~NGon2D()=default
DGtal::NGon2D::center
RealPoint center() const
Definition: NGon2D.h:143