DGtal  0.9.2
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
96  Value operator()(const RealPoint &aPoint) const
97  {
98  return myRadius - (aPoint - myCenter ).norm();
99  }
100 
101  inline
102  Orientation orientation(const RealPoint &aPoint) const
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
114  RealPoint getLowerBound() const
115  {
117  }
118 
119  inline
120  RealPoint getUpperBound() const
121  {
123  }
124 
125 
126 
127  // ----------------------- Interface --------------------------------------
128  public:
129 
134  void selfDisplay ( std::ostream & out ) const;
135 
140  bool isValid() const;
141 
142  // ------------------------- Protected Datas ------------------------------
143  private:
144  // ------------------------- Private Datas --------------------------------
145  private:
146 
148  RealPoint myCenter;
149 
151  double myRadius;
152 
153  // ------------------------- Hidden services ------------------------------
154  protected:
155 
160  ImplicitBall();
161 
162  private:
163 
170  ImplicitBall & operator= ( const ImplicitBall & other );
171 
172 
173  }; // end of class ImplicitBall
174 
175 
182  template <typename T>
183  std::ostream&
184  operator<< ( std::ostream & out, const ImplicitBall<T> & object );
185 
186 } // namespace DGtal
187 
188 
190 // Includes inline functions.
191 #include "DGtal/shapes/implicit/ImplicitBall.ih"
192 
193 // //
195 
196 #endif // !defined ImplicitBall_h
197 
198 #undef ImplicitBall_RECURSES
199 #endif // else defined(ImplicitBall_RECURSES)
Space::Integer Integer
Definition: ImplicitBall.h:71
RealPoint getUpperBound() const
Definition: ImplicitBall.h:120
RealPoint myCenter
Ball center.
Definition: ImplicitBall.h:148
static Self diagonal(Component val=1)
RealPoint getLowerBound() const
Definition: ImplicitBall.h:114
bool isValid() const
ImplicitBall< TSpace > Self
Definition: ImplicitBall.h:68
Space::RealPoint RealPoint
Definition: ImplicitBall.h:70
ImplicitBall(const RealPoint &aCenter, const double &aRadius)
Definition: ImplicitBall.h:81
Value operator()(const RealPoint &aPoint) const
Definition: ImplicitBall.h:96
double myRadius
Ball Radius.
Definition: ImplicitBall.h:151
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
Orientation
Definition: Common.h:118
Orientation orientation(const RealPoint &aPoint) const
Definition: ImplicitBall.h:102
ImplicitBall & operator=(const ImplicitBall &other)
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD...
Definition: ImplicitBall.h:64
DGtal is the top-level namespace which contains all DGtal functions and types.
void selfDisplay(std::ostream &out) const