DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
src
DGtal
shapes
implicit
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>
59
class
ImplicitNorm1Ball
60
{
61
62
public
:
63
typedef
ImplicitNorm1Ball<TSpace>
Self
;
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
84
~ImplicitNorm1Ball
();
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
{
139
return
(
myCenter
- RealPoint::diagonal(
myHalfWidth
));
140
}
141
148
inline
149
RealPoint
getUpperBound
()
const
150
{
151
return
(
myCenter
+ RealPoint::diagonal(
myHalfWidth
));
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
187
ImplicitNorm1Ball
();
188
189
private
:
190
197
ImplicitNorm1Ball
&
operator=
(
const
ImplicitNorm1Ball
& other );
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)
Generated on Wed Dec 19 2012 19:10:27 for DGtal by
1.8.1.1