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
ImplicitRoundedHyperCube.h
1
17
#pragma once
18
31
#if defined(ImplicitRoundedHyperCube_RECURSES)
32
#error Recursive header files inclusion detected in ImplicitRoundedHyperCube.h
33
#else // defined(ImplicitRoundedHyperCube_RECURSES)
34
35
#define ImplicitRoundedHyperCube_RECURSES
36
37
#if !defined ImplicitRoundedHyperCube_h
38
39
#define ImplicitRoundedHyperCube_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
46
47
namespace
DGtal
48
{
49
52
61
template
<
typename
TSpace>
62
class
ImplicitRoundedHyperCube
63
{
64
65
public
:
66
typedef
ImplicitRoundedHyperCube<TSpace>
Self
;
67
typedef
TSpace
Space
;
68
typedef
typename
Space::RealPoint
RealPoint
;
69
typedef
double
Value
;
70
78
ImplicitRoundedHyperCube
(
const
RealPoint
&aCenter,
79
const
double
&aHalfWidth,
80
const
double
aPower):
81
myCenter
(aCenter),
82
myHalfWidth
(aHalfWidth),
83
myPower
(aPower)
84
{};
85
90
~ImplicitRoundedHyperCube
();
91
92
93
// ----------------------- Interface --------------------------------------
94
public
:
95
104
inline
105
double
operator()
(
const
RealPoint
&aPoint)
const
106
{
107
RealPoint
dec = (aPoint -
myCenter
);
108
double
partialpower=0;
109
for
(
Dimension
i = 0; i < RealPoint::dimension; ++i)
110
partialpower += std::pow(std::abs((
double
)dec[i]),
myPower
);
111
112
return
std::pow(
myHalfWidth
,
myPower
) - partialpower;
113
}
114
121
inline
122
bool
isInside
(
const
RealPoint
&aPoint)
const
123
{
124
return
this->
operator()
(aPoint) >0.0;
125
}
126
134
inline
135
Orientation
orientation
(
const
RealPoint
&aPoint)
const
136
{
137
if
(this->
operator
()(aPoint) > 0.0)
138
return
INSIDE
;
139
else
140
if
(this->
operator
()(aPoint) < 0.0)
141
return
OUTSIDE
;
142
else
143
return
ON
;
144
}
145
146
153
inline
154
RealPoint
getLowerBound
()
const
155
{
156
return
(
myCenter
- RealPoint::diagonal(
myHalfWidth
));
157
}
158
165
inline
166
RealPoint
getUpperBound
()
const
167
{
168
return
(
myCenter
+ RealPoint::diagonal(
myHalfWidth
));
169
}
170
171
// ----------------------- Interface --------------------------------------
172
public
:
173
178
void
selfDisplay
( std::ostream & out )
const
;
179
184
bool
isValid
()
const
;
185
186
// ------------------------- Protected Datas ------------------------------
187
private
:
188
// ------------------------- Private Datas --------------------------------
189
private
:
190
192
RealPoint
myCenter
;
193
195
double
myHalfWidth
;
196
198
double
myPower
;
199
200
// ------------------------- Hidden services ------------------------------
201
protected
:
202
207
ImplicitRoundedHyperCube
();
208
209
private
:
210
217
ImplicitRoundedHyperCube
&
operator=
(
const
ImplicitRoundedHyperCube
& other );
218
219
220
};
// end of class ImplicitRoundedHyperCube
221
222
229
template
<
typename
T>
230
std::ostream&
231
operator<< ( std::ostream & out, const ImplicitRoundedHyperCube<T> & object );
232
233
}
// namespace DGtal
234
235
237
// Includes inline functions.
238
#include "DGtal/shapes/implicit/ImplicitRoundedHyperCube.ih"
239
240
// //
242
243
#endif // !defined ImplicitRoundedHyperCube_h
244
245
#undef ImplicitRoundedHyperCube_RECURSES
246
#endif // else defined(ImplicitRoundedHyperCube_RECURSES)
Generated on Wed Dec 19 2012 19:10:27 for DGtal by
1.8.1.1