DGtal  0.9.2
ImplicitHyperCube.h
1 
17 #pragma once
18 
31 #if defined(ImplicitHyperCube_RECURSES)
32 #error Recursive header files inclusion detected in ImplicitHyperCube.h
33 #else // defined(ImplicitHyperCube_RECURSES)
34 
35 #define ImplicitHyperCube_RECURSES
36 
37 #if !defined ImplicitHyperCube_h
38 
39 #define ImplicitHyperCube_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
46 
47 namespace DGtal
48 {
49 
51 
58  template <typename TSpace>
60  {
61 
62  public:
64  typedef TSpace Space;
65  typedef typename Space::RealPoint RealPoint;
66  typedef double Value;
67 
75  ImplicitHyperCube(const RealPoint &aCenter, const double &aHalfWidth):
76  myCenter(aCenter),
77  myHalfWidth(aHalfWidth)
78  {};
79 
85 
86 
87  // ----------------------- Interface --------------------------------------
88  public:
89 
98  inline
99  double operator()(const RealPoint &aPoint) const
100  {
101  return myHalfWidth - (aPoint - myCenter ).norm(RealPoint::L_infty);
102  }
103 
104 
111  inline
112  bool isInside(const RealPoint &aPoint) const
113  {
114  return this->operator()(aPoint) >0.0;
115  }
116 
117 
118  inline
119  Orientation orientation(const RealPoint &aPoint) const
120  {
121  if (this->operator()(aPoint) > 0.0)
122  return INSIDE;
123  else
124  if (this->operator()(aPoint) < 0.0)
125  return OUTSIDE;
126  else
127  return ON;
128  }
129 
136  inline
137  RealPoint getLowerBound() const
138  {
140  }
141 
148  inline
149  RealPoint getUpperBound() const
150  {
152  }
153 
154 
155  // ----------------------- Interface --------------------------------------
156  public:
157 
162  void selfDisplay ( std::ostream & out ) const;
163 
168  bool isValid() const;
169 
170  // ------------------------- Protected Datas ------------------------------
171  private:
172  // ------------------------- Private Datas --------------------------------
173  private:
174 
176  RealPoint myCenter;
177 
179  double myHalfWidth;
180 
181  // ------------------------- Hidden services ------------------------------
182  protected:
183 
189 
190  private:
191 
199 
200 
201  }; // end of class ImplicitHyperCube
202 
203 
210  template <typename T>
211  std::ostream&
212  operator<< ( std::ostream & out, const ImplicitHyperCube<T> & object );
213 
214 } // namespace DGtal
215 
216 
218 // Includes inline functions.
219 #include "DGtal/shapes/implicit/ImplicitHyperCube.ih"
220 
221 // //
223 
224 #endif // !defined ImplicitHyperCube_h
225 
226 #undef ImplicitHyperCube_RECURSES
227 #endif // else defined(ImplicitHyperCube_RECURSES)
RealPoint getLowerBound() const
RealPoint getUpperBound() const
Space::RealPoint RealPoint
static Self diagonal(Component val=1)
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
Orientation orientation(const RealPoint &aPoint) const
Orientation
Definition: Common.h:118
ImplicitHyperCube(const RealPoint &aCenter, const double &aHalfWidth)
void selfDisplay(std::ostream &out) const
double operator()(const RealPoint &aPoint) const
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create an hypercube in n...
DGtal is the top-level namespace which contains all DGtal functions and types.
ImplicitHyperCube & operator=(const ImplicitHyperCube &other)
RealPoint myCenter
Ball center.
ImplicitHyperCube< TSpace > Self
bool isInside(const RealPoint &aPoint) const
double myHalfWidth
Ball HalfWidth.