DGtal  1.0.0
Lemniscate2D.h
1 
17 #pragma once
18 
31 #if defined(Lemniscate2D_RECURSES)
32 #error Recursive header files inclusion detected in Lemniscate2D.h
33 #else // defined(Lemniscate2D_RECURSES)
34 
35 #define Lemniscate2D_RECURSES
36 
37 #if !defined Lemniscate2D_h
38 
39 #define Lemniscate2D_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 Lemniscate2D
60  template <typename TSpace>
61  class Lemniscate2D : public DGtal::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  ~Lemniscate2D();
75 
83  Lemniscate2D( const double x0, const double y0,
84  const double a, const double b);
85 
92  Lemniscate2D( const RealPoint2D &aPoint, const double a, const double b );
93 
100  Lemniscate2D( 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  Lemniscate2D();
208 
209  private:
210 
216  // Lemniscate2D ( const Lemniscate2D & other );
217 
224  Lemniscate2D & operator= ( const Lemniscate2D & other );
225 
226  // ------------------------- Internals ------------------------------------
227  private:
228 
229  }; // end of class Lemniscate2D
230 
231 
232 
239  template <typename T>
240  std::ostream&
241  operator<< ( std::ostream & out, const Lemniscate2D<T> & object );
242 
243 } // namespace DGtal
244 
245 
247 // Includes inline functions.
248 #include "DGtal/shapes/parametric/Lemniscate2D.ih"
249 
250 // //
252 
253 #endif // !defined Lemniscate2D_h
254 
255 #undef Lemniscate2D_RECURSES
256 #endif // else defined(Lemniscate2D_RECURSES)
const Point aPoint(3, 4)
RealPoint2D getUpperBound() const
Definition: Lemniscate2D.h:119
Aim: Model of the concept StarShaped represents a lemniscate.
Definition: Lemniscate2D.h:61
void selfDisplay(std::ostream &out) const
Space::Point Point2D
Definition: Lemniscate2D.h:67
Space::RealPoint RealPoint2D
Definition: Lemniscate2D.h:68
RealPoint2D center() const
Definition: Lemniscate2D.h:127
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
double parameter(const RealPoint2D &p) const
Space::RealVector RealVector2D
Definition: Lemniscate2D.h:69
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
bool isValid() const
DGtal is the top-level namespace which contains all DGtal functions and types.
RealVector2D xpp(const double t) const
RealPoint2D getLowerBound() const
Definition: Lemniscate2D.h:110
RealPoint2D myCenter
Definition: Lemniscate2D.h:171
RealVector2D xp(const double t) const
RealPoint2D x(const double t) const
Lemniscate2D & operator=(const Lemniscate2D &other)