DGtal  1.3.beta
Ball2D.h
1 
17 #pragma once
18 
31 #if defined(Ball2D_RECURSES)
32 #error Recursive header files inclusion detected in Ball2D.h
33 #else // defined(Ball2D_RECURSES)
34 
35 #define Ball2D_RECURSES
36 
37 #if !defined Ball2D_h
38 
39 #define Ball2D_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/shapes/parametric/StarShaped2D.h"
47 
48 namespace DGtal
49 {
50 
52  // template class Ball2D
59  template <typename TSpace>
60  class Ball2D final: public StarShaped2D<TSpace>
61  {
62  // ----------------------- Standard services ------------------------------
63  public:
64 
65  typedef TSpace Space;
66  typedef typename Space::RealPoint RealPoint;
67  typedef typename Space::RealVector RealVector;
68 
73  Ball2D() = delete;
74 
81  Ball2D( const double x0, const double y0, const double r );
82 
88  Ball2D( const RealPoint &aPoint, const double r );
89 
94  Ball2D( const Ball2D & other );
95 
102  Ball2D& operator=( const Ball2D& other ) = delete;
103 
107  ~Ball2D() = default;
108 
109  // ------------- Implementation of 'StarShaped' services ------------------
110  public:
111 
117  {
118  return myCenter - myRadius;
119  }
120 
126  {
127  return myCenter + myRadius;
128  }
129 
134  {
135  return myCenter;
136  }
137 
142  inline
143  void moveTo( const RealPoint& newCenter )
144  {
145  myCenter = newCenter;
146  }
147 
154  double parameter( const RealPoint & p ) const;
155 
156 
163  RealPoint x( const double t ) const;
164 
171  RealVector xp( const double t ) const;
172 
178  RealVector xpp( const double t ) const;
179 
180 
181  // ------------------------- data ----------------------------
182  private:
183 
187  double myRadius;
188 
193 
194 
195  // ----------------------- Interface --------------------------------------
196  public:
197 
202  void selfDisplay ( std::ostream & out ) const;
203 
208  bool isValid() const;
209 
210  }; // end of class Ball2D
211 
212 
219  template <typename T>
220  std::ostream&
221  operator<< ( std::ostream & out, const Ball2D<T> & object );
222 
223 } // namespace DGtal
224 
225 
227 // Includes inline functions.
228 #include "DGtal/shapes/parametric/Ball2D.ih"
229 
230 // //
232 
233 #endif // !defined Ball2D_h
234 
235 #undef Ball2D_RECURSES
236 #endif // else defined(Ball2D_RECURSES)
DGtal::Ball2D::Ball2D
Ball2D()=delete
DGtal::Ball2D::myCenter
RealPoint myCenter
Definition: Ball2D.h:192
DGtal::Ball2D::center
RealPoint center() const
Definition: Ball2D.h:133
DGtal::Ball2D::parameter
double parameter(const RealPoint &p) const
DGtal::Ball2D::isValid
bool isValid() const
aPoint
const Point aPoint(3, 4)
DGtal::Ball2D::operator=
Ball2D & operator=(const Ball2D &other)=delete
DGtal::Ball2D::Space
TSpace Space
Definition: Ball2D.h:65
DGtal::StarShaped2D
Definition: StarShaped2D.h:74
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::Ball2D
Aim: Model of the concept StarShaped represents any circle in the plane.
Definition: Ball2D.h:60
DGtal::Ball2D::getLowerBound
RealPoint getLowerBound() const
Definition: Ball2D.h:116
DGtal::Ball2D::moveTo
void moveTo(const RealPoint &newCenter)
Definition: Ball2D.h:143
DGtal::Ball2D::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::Ball2D::x
RealPoint x(const double t) const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::Ball2D::xp
RealVector xp(const double t) const
DGtal::Ball2D::RealVector
Space::RealVector RealVector
Definition: Ball2D.h:67
DGtal::Ball2D::getUpperBound
RealPoint getUpperBound() const
Definition: Ball2D.h:125
DGtal::Ball2D::myRadius
double myRadius
Definition: Ball2D.h:187
DGtal::SpaceND::RealPoint
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::Ball2D::RealPoint
Space::RealPoint RealPoint
Definition: Ball2D.h:66
DGtal::Ball2D::~Ball2D
~Ball2D()=default
DGtal::Ball2D::xpp
RealVector xpp(const double t) const