DGtal  1.4.beta
ImplicitBall.h
1 
17 #pragma once
18 
31 #if defined(ImplicitBall_RECURSES)
32 #error Recursive header files inclusion detected in ImplicitBall.h
33 #else // defined(ImplicitBall_RECURSES)
34 
35 #define ImplicitBall_RECURSES
36 
37 #if !defined ImplicitBall_h
38 
39 #define ImplicitBall_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/kernel/NumberTraits.h"
46 #include "DGtal/shapes/implicit/CImplicitFunction.h"
48 
49 namespace DGtal
50 {
51 
53 
63  template <typename TSpace>
65  {
66 
67  public:
69  typedef TSpace Space;
70  typedef typename Space::RealPoint RealPoint;
71  typedef typename Space::Integer Integer;
72  typedef double Value;
73 
81  ImplicitBall(const RealPoint &aCenter, const double &aRadius): myCenter(aCenter),
82  myRadius(aRadius)
83  {};
84 
89  ~ImplicitBall();
90 
91 
92  // ----------------------- Interface --------------------------------------
93  public:
94 
95  inline
97  {
98  return myRadius - (aPoint - myCenter ).norm();
99  }
100 
101  inline
103  {
104  if (this->operator()(aPoint) > 0.0)
105  return INSIDE;
106  else
107  if (this->operator()(aPoint) < 0.0)
108  return OUTSIDE;
109  else
110  return ON;
111  }
112 
113  inline
115  {
117  }
118 
119  inline
121  {
123  }
124 
129  {
130  return myCenter;
131  }
132 
137  inline
138  void moveTo( const RealPoint& newCenter )
139  {
140  myCenter = newCenter;
141  }
142 
143  // ----------------------- Interface --------------------------------------
144  public:
145 
150  void selfDisplay ( std::ostream & out ) const;
151 
156  bool isValid() const;
157 
158  // ------------------------- Protected Datas ------------------------------
159  private:
160  // ------------------------- Private Datas --------------------------------
161  private:
162 
165 
167  double myRadius;
168 
169  // ------------------------- Hidden services ------------------------------
170  protected:
171 
176  ImplicitBall();
177 
178  private:
179 
186  ImplicitBall & operator= ( const ImplicitBall & other );
187 
188 
189  }; // end of class ImplicitBall
190 
191 
198  template <typename T>
199  std::ostream&
200  operator<< ( std::ostream & out, const ImplicitBall<T> & object );
201 
202 } // namespace DGtal
203 
204 
206 // Includes inline functions.
207 #include "DGtal/shapes/implicit/ImplicitBall.ih"
208 
209 // //
211 
212 #endif // !defined ImplicitBall_h
213 
214 #undef ImplicitBall_RECURSES
215 #endif // else defined(ImplicitBall_RECURSES)
DGtal::ImplicitBall::isValid
bool isValid() const
DGtal::ImplicitBall::getUpperBound
RealPoint getUpperBound() const
Definition: ImplicitBall.h:120
DGtal::ImplicitBall::getLowerBound
RealPoint getLowerBound() const
Definition: ImplicitBall.h:114
DGtal::ImplicitBall::orientation
Orientation orientation(const RealPoint &aPoint) const
Definition: ImplicitBall.h:102
DGtal::ON
@ ON
Definition: Common.h:142
aPoint
const Point aPoint(3, 4)
DGtal::PointVector::diagonal
static Self diagonal(Component val=1)
DGtal::ImplicitBall::ImplicitBall
ImplicitBall()
DGtal::ImplicitBall::moveTo
void moveTo(const RealPoint &newCenter)
Definition: ImplicitBall.h:138
DGtal::ImplicitBall::myRadius
double myRadius
Ball Radius.
Definition: ImplicitBall.h:167
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::Orientation
Orientation
Definition: Common.h:142
DGtal::ImplicitBall::myCenter
RealPoint myCenter
Ball center.
Definition: ImplicitBall.h:164
DGtal::ImplicitBall::operator=
ImplicitBall & operator=(const ImplicitBall &other)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::ImplicitBall
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Definition: ImplicitBall.h:64
DGtal::ImplicitBall::RealPoint
Space::RealPoint RealPoint
Definition: ImplicitBall.h:70
DGtal::ImplicitBall::operator()
Value operator()(const RealPoint &aPoint) const
Definition: ImplicitBall.h:96
DGtal::ImplicitBall::ImplicitBall
ImplicitBall(const RealPoint &aCenter, const double &aRadius)
Definition: ImplicitBall.h:81
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::OUTSIDE
@ OUTSIDE
Definition: Common.h:142
DGtal::ImplicitBall::~ImplicitBall
~ImplicitBall()
DGtal::ImplicitBall::center
RealPoint center() const
Definition: ImplicitBall.h:128
DGtal::ImplicitBall::Space
TSpace Space
Definition: ImplicitBall.h:69
DGtal::ImplicitBall::Integer
Space::Integer Integer
Definition: ImplicitBall.h:71
DGtal::SpaceND::Integer
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
DGtal::ImplicitBall::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::ImplicitBall::Self
ImplicitBall< TSpace > Self
Definition: ImplicitBall.h:68
DGtal::ImplicitBall::Value
double Value
Definition: ImplicitBall.h:72
DGtal::INSIDE
@ INSIDE
Definition: Common.h:142