DGtal  1.1.0
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
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
138  {
140  }
141 
148  inline
150  {
152  }
153 
158  {
159  return myCenter;
160  }
161 
166  inline
167  void moveTo( const RealPoint& newCenter )
168  {
169  myCenter = newCenter;
170  }
171 
172  // ----------------------- Interface --------------------------------------
173  public:
174 
179  void selfDisplay ( std::ostream & out ) const;
180 
185  bool isValid() const;
186 
187  // ------------------------- Protected Datas ------------------------------
188  private:
189  // ------------------------- Private Datas --------------------------------
190  private:
191 
194 
196  double myHalfWidth;
197 
198  // ------------------------- Hidden services ------------------------------
199  protected:
200 
206 
207  private:
208 
216 
217 
218  }; // end of class ImplicitNorm1Ball
219 
220 
227  template <typename T>
228  std::ostream&
229  operator<< ( std::ostream & out, const ImplicitNorm1Ball<T> & object );
230 
231 } // namespace DGtal
232 
233 
235 // Includes inline functions.
236 #include "DGtal/shapes/implicit/ImplicitNorm1Ball.ih"
237 
238 // //
240 
241 #endif // !defined ImplicitNorm1Ball_h
242 
243 #undef ImplicitNorm1Ball_RECURSES
244 #endif // else defined(ImplicitNorm1Ball_RECURSES)
DGtal::ImplicitNorm1Ball::myCenter
RealPoint myCenter
Ball center.
Definition: ImplicitNorm1Ball.h:193
DGtal::ImplicitNorm1Ball::operator()
double operator()(const RealPoint &aPoint) const
Definition: ImplicitNorm1Ball.h:99
DGtal::ImplicitNorm1Ball::center
RealPoint center() const
Definition: ImplicitNorm1Ball.h:157
DGtal::ImplicitNorm1Ball::isInside
bool isInside(const RealPoint &aPoint) const
Definition: ImplicitNorm1Ball.h:111
DGtal::ImplicitNorm1Ball::~ImplicitNorm1Ball
~ImplicitNorm1Ball()
DGtal::ImplicitNorm1Ball::Space
TSpace Space
Definition: ImplicitNorm1Ball.h:64
DGtal::ON
@ ON
Definition: Common.h:138
aPoint
const Point aPoint(3, 4)
DGtal::PointVector::diagonal
static Self diagonal(Component val=1)
DGtal::ImplicitNorm1Ball::getUpperBound
RealPoint getUpperBound() const
Definition: ImplicitNorm1Ball.h:149
DGtal::ImplicitNorm1Ball::isValid
bool isValid() const
DGtal::PointVector::L_1
@ L_1
Definition: PointVector.h:1488
DGtal::ImplicitNorm1Ball::moveTo
void moveTo(const RealPoint &newCenter)
Definition: ImplicitNorm1Ball.h:167
DGtal::ImplicitNorm1Ball::RealPoint
Space::RealPoint RealPoint
Definition: ImplicitNorm1Ball.h:65
DGtal::Orientation
Orientation
Definition: Common.h:138
DGtal::ImplicitNorm1Ball
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball for the L_...
Definition: ImplicitNorm1Ball.h:60
DGtal::ImplicitNorm1Ball::getLowerBound
RealPoint getLowerBound() const
Definition: ImplicitNorm1Ball.h:137
DGtal::ImplicitNorm1Ball::ImplicitNorm1Ball
ImplicitNorm1Ball()
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::ImplicitNorm1Ball::Self
ImplicitNorm1Ball< TSpace > Self
Definition: ImplicitNorm1Ball.h:63
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
DGtal::OUTSIDE
@ OUTSIDE
Definition: Common.h:138
DGtal::ImplicitNorm1Ball::operator=
ImplicitNorm1Ball & operator=(const ImplicitNorm1Ball &other)
DGtal::ImplicitNorm1Ball::ImplicitNorm1Ball
ImplicitNorm1Ball(const RealPoint &aCenter, const double &aHalfWidth)
Definition: ImplicitNorm1Ball.h:75
DGtal::ImplicitNorm1Ball::orientation
Orientation orientation(const RealPoint &aPoint) const
Definition: ImplicitNorm1Ball.h:119
DGtal::ImplicitNorm1Ball::Value
double Value
Definition: ImplicitNorm1Ball.h:66
DGtal::INSIDE
@ INSIDE
Definition: Common.h:138
DGtal::ImplicitNorm1Ball::myHalfWidth
double myHalfWidth
Ball HalfWidth.
Definition: ImplicitNorm1Ball.h:196
DGtal::ImplicitNorm1Ball::selfDisplay
void selfDisplay(std::ostream &out) const