DGtal 1.3.0
Loading...
Searching...
No Matches
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)
35#define ImplicitNorm1Ball_RECURSES
36
37#if !defined ImplicitNorm1Ball_h
39#define ImplicitNorm1Ball_h
40
42// Inclusions
43#include <iostream>
44#include "DGtal/base/Common.h"
46
47namespace 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
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)
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball for the L_...
Space::RealPoint RealPoint
void selfDisplay(std::ostream &out) const
ImplicitNorm1Ball(const RealPoint &aCenter, const double &aHalfWidth)
bool isInside(const RealPoint &aPoint) const
ImplicitNorm1Ball< TSpace > Self
RealPoint myCenter
Ball center.
void moveTo(const RealPoint &newCenter)
RealPoint getLowerBound() const
double myHalfWidth
Ball HalfWidth.
ImplicitNorm1Ball & operator=(const ImplicitNorm1Ball &other)
double operator()(const RealPoint &aPoint) const
RealPoint getUpperBound() const
Orientation orientation(const RealPoint &aPoint) const
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
static Self diagonal(Component val=1)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Orientation
Definition: Common.h:142
@ INSIDE
Definition: Common.h:142
@ OUTSIDE
Definition: Common.h:142
@ ON
Definition: Common.h:142
const Point aPoint(3, 4)