DGtal 1.3.0
Loading...
Searching...
No Matches
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)
37#define NGon2D_RECURSES
38
39#if !defined NGon2D_h
41#define NGon2D_h
42
44// Inclusions
45#include <iostream>
46#include "DGtal/base/Common.h"
47#include "DGtal/shapes/parametric/StarShaped2D.h"
49
50namespace 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)
Aim: Model of the concept StarShaped represents any regular k-gon in the plane.
Definition: NGon2D.h:64
double myPhi
Definition: NGon2D.h:212
RealPoint myCenter
Definition: NGon2D.h:197
Space::RealVector RealVector
Definition: NGon2D.h:70
RealVector xpp(const double t) const
Space::RealPoint RealPoint
Definition: NGon2D.h:69
RealPoint getLowerBound() const
Definition: NGon2D.h:126
RealPoint x(const double t) const
double parameter(const RealPoint &p) const
NGon2D(const RealPoint &aPoint, const double r, const unsigned int k, const double phi)
~NGon2D()=default
NGon2D(const NGon2D &other)
NGon2D(const double x0, const double y0, const double r, const unsigned int k, const double phi)
NGon2D & operator=(const NGon2D &other)=delete
RealVector xp(const double t) const
NGon2D()=delete
void selfDisplay(std::ostream &out) const
unsigned int myK
Definition: NGon2D.h:207
RealPoint getUpperBound() const
Definition: NGon2D.h:135
TSpace Space
Definition: NGon2D.h:68
void moveTo(const RealPoint &newCenter)
Definition: NGon2D.h:153
double myRadius
Definition: NGon2D.h:202
bool isValid() const
RealPoint center() const
Definition: NGon2D.h:143
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
const Point aPoint(3, 4)