DGtal  0.9.2
ImplicitNorm1Ball.h
1 
17 #pragma once
18 
31 #if defined(ImplicitNorm1Ball_RECURSES)
32 #error Recursive header files inclusion detected in ImplicitNorm1Ball.h
33 #else // defined(ImplicitNorm1Ball_RECURSES)
34 
35 #define ImplicitNorm1Ball_RECURSES
36 
37 #if !defined ImplicitNorm1Ball_h
38 
39 #define ImplicitNorm1Ball_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  ImplicitNorm1Ball(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 (aPoint - myCenter ).norm(RealPoint::L_1);
102  }
103 
110  inline
111  bool isInside(const RealPoint &aPoint) const
112  {
113  return this->operator()(aPoint) >0.0;
114  }
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  // ----------------------- Interface --------------------------------------
155  public:
156 
161  void selfDisplay ( std::ostream & out ) const;
162 
167  bool isValid() const;
168 
169  // ------------------------- Protected Datas ------------------------------
170  private:
171  // ------------------------- Private Datas --------------------------------
172  private:
173 
175  RealPoint myCenter;
176 
178  double myHalfWidth;
179 
180  // ------------------------- Hidden services ------------------------------
181  protected:
182 
188 
189  private:
190 
198 
199 
200  }; // end of class ImplicitNorm1Ball
201 
202 
209  template <typename T>
210  std::ostream&
211  operator<< ( std::ostream & out, const ImplicitNorm1Ball<T> & object );
212 
213 } // namespace DGtal
214 
215 
217 // Includes inline functions.
218 #include "DGtal/shapes/implicit/ImplicitNorm1Ball.ih"
219 
220 // //
222 
223 #endif // !defined ImplicitNorm1Ball_h
224 
225 #undef ImplicitNorm1Ball_RECURSES
226 #endif // else defined(ImplicitNorm1Ball_RECURSES)
static Self diagonal(Component val=1)
ImplicitNorm1Ball< TSpace > Self
RealPoint myCenter
Ball center.
Orientation orientation(const RealPoint &aPoint) const
ImplicitNorm1Ball & operator=(const ImplicitNorm1Ball &other)
void selfDisplay(std::ostream &out) const
double myHalfWidth
Ball HalfWidth.
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball for the L_...
Orientation
Definition: Common.h:118
double operator()(const RealPoint &aPoint) const
RealPoint getUpperBound() const
bool isInside(const RealPoint &aPoint) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Space::RealPoint RealPoint
ImplicitNorm1Ball(const RealPoint &aCenter, const double &aHalfWidth)
RealPoint getLowerBound() const