DGtal 1.3.0
Loading...
Searching...
No Matches
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)
35#define Ball2D_RECURSES
36
37#if !defined Ball2D_h
39#define Ball2D_h
40
42// Inclusions
43#include <iostream>
44#include "DGtal/base/Common.h"
45#include "DGtal/shapes/parametric/StarShaped2D.h"
47
48namespace 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)
Aim: Model of the concept StarShaped represents any circle in the plane.
Definition: Ball2D.h:61
Ball2D(const RealPoint &aPoint, const double r)
bool isValid() const
Ball2D & operator=(const Ball2D &other)=delete
Ball2D(const double x0, const double y0, const double r)
void selfDisplay(std::ostream &out) const
RealPoint x(const double t) const
~Ball2D()=default
Space::RealPoint RealPoint
Definition: Ball2D.h:66
double myRadius
Definition: Ball2D.h:187
RealVector xp(const double t) const
RealPoint center() const
Definition: Ball2D.h:133
RealPoint getUpperBound() const
Definition: Ball2D.h:125
double parameter(const RealPoint &p) const
TSpace Space
Definition: Ball2D.h:65
RealPoint getLowerBound() const
Definition: Ball2D.h:116
Ball2D()=delete
RealVector xpp(const double t) const
Space::RealVector RealVector
Definition: Ball2D.h:67
void moveTo(const RealPoint &newCenter)
Definition: Ball2D.h:143
Ball2D(const Ball2D &other)
RealPoint myCenter
Definition: Ball2D.h:192
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)