DGtal  1.0.0
Astroid2D.h
1 
17 #pragma once
18 
31 #if defined(Astroid2D_RECURSES)
32 #error Recursive header files inclusion detected in Astroid2D.h
33 #else // defined(Astroid2D_RECURSES)
34 
35 #define Astroid2D_RECURSES
36 
37 #if !defined Astroid2D_h
38 
39 #define Astroid2D_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <DGtal/base/Common.h>
45 #include <DGtal/shapes/parametric/StarShaped2D.h>
46 #include <cmath>
48 
49 namespace DGtal
50 {
51 
53  // template class Astroid2D
60  template <typename TSpace>
61  class Astroid2D : public StarShaped2D<TSpace>
62  {
63  // ----------------------- Standard services ------------------------------
64  public:
65 
66  typedef TSpace Space;
67  typedef typename Space::Point Point2D;
68  typedef typename Space::RealPoint RealPoint2D;
69  typedef typename Space::RealVector RealVector2D;
70 
74  ~Astroid2D();
75 
83  Astroid2D( const double x0, const double y0,
84  const double a, const double b );
85 
92  Astroid2D( const RealPoint2D &aPoint, const double a, const double b );
93 
100  Astroid2D( const Point2D &aPoint, const double a, const double b );
101 
102 
103  // ------------- Implementation of 'StarShaped' services -------------------
104  public:
105 
111  {
112  return RealPoint2D(-myA - myCenter[0] , -myB - myCenter[1] );
113  }
114 
120  {
121  return RealPoint2D(myA - myCenter[0] , myB - myCenter[1]);
122  }
123 
128  {
129  return myCenter;
130  }
131 
138  double parameter( const RealPoint2D & p ) const;
139 
140 
147  RealPoint2D x( const double t ) const;
148 
155  RealVector2D xp( const double t ) const;
156 
162  RealVector2D xpp( const double t ) const;
163 
164 
165  // ------------------------- data -----------------------------------------
166  private:
167 
172 
176  double myA;
177 
181  double myB;
182 
183  // ----------------------- Interface --------------------------------------
184  public:
185 
190  void selfDisplay ( std::ostream & out ) const;
191 
192 
197  bool isValid() const;
198 
199 
200  // ------------------------- Hidden services ------------------------------
201  protected:
202 
207  Astroid2D();
208 
209  private:
210 
216  // Astroid2D ( const Astroid2D & other );
217 
224  Astroid2D & operator= ( const Astroid2D & other );
225 
226  // ------------------------- Internals ------------------------------------
227  private:
228 
229  }; // end of class Astroid2D
230 
231 
232 
239  template <typename T>
240  std::ostream&
241  operator<< ( std::ostream & out, const Astroid2D<T> & object );
242 
243 } // namespace DGtal
244 
245 
247 // Includes inline functions.
248 #include "DGtal/shapes/parametric/Astroid2D.ih"
249 
250 // //
252 
253 #endif // !defined Astroid2D_h
254 
255 #undef Astroid2D_RECURSES
256 #endif // else defined(Astroid2D_RECURSES)
const Point aPoint(3, 4)
RealVector2D xpp(const double t) const
RealVector2D xp(const double t) const
RealPoint2D getUpperBound() const
Definition: Astroid2D.h:119
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
Aim: Model of the concept StarShaped represents an astroid.
Definition: Astroid2D.h:61
RealPoint2D getLowerBound() const
Definition: Astroid2D.h:110
Space::RealVector RealVector2D
Definition: Astroid2D.h:69
Astroid2D & operator=(const Astroid2D &other)
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
RealPoint2D center() const
Definition: Astroid2D.h:127
Space::Point Point2D
Definition: Astroid2D.h:67
RealPoint2D myCenter
Definition: Astroid2D.h:171
Space::RealPoint RealPoint2D
Definition: Astroid2D.h:68
DGtal is the top-level namespace which contains all DGtal functions and types.
RealPoint2D x(const double t) const
bool isValid() const
void selfDisplay(std::ostream &out) const
double parameter(const RealPoint2D &p) const