DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
ImplicitRoundedHyperCube.h
1
16
17
#pragma once
18
30
31
#if defined(ImplicitRoundedHyperCube_RECURSES)
32
#error Recursive header files inclusion detected in ImplicitRoundedHyperCube.h
33
#else
// defined(ImplicitRoundedHyperCube_RECURSES)
35
#define ImplicitRoundedHyperCube_RECURSES
36
37
#if !defined ImplicitRoundedHyperCube_h
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
79
ImplicitRoundedHyperCube
(
const
RealPoint
&aCenter,
80
const
double
&aHalfWidth,
81
const
double
aPower):
82
myCenter
(aCenter),
83
myHalfWidth
(aHalfWidth),
84
myPower
(aPower)
85
{};
86
91
~ImplicitRoundedHyperCube
();
92
93
94
// ----------------------- Interface --------------------------------------
95
public
:
96
105
inline
106
double
operator()
(
const
RealPoint
&
aPoint
)
const
107
{
108
RealPoint
dec = (
aPoint
-
myCenter
);
109
double
partialpower=0;
110
for
(
Dimension
i = 0; i <
RealPoint::dimension
; ++i)
111
partialpower += std::pow(std::abs((
double
)dec[i]),
myPower
);
112
113
return
std::pow(
myHalfWidth
,
myPower
) - partialpower;
114
}
115
122
inline
123
bool
isInside
(
const
RealPoint
&
aPoint
)
const
124
{
125
return
this->
operator()
(
aPoint
) >0.0;
126
}
127
135
inline
136
Orientation
orientation
(
const
RealPoint
&
aPoint
)
const
137
{
138
if
(this->
operator
()(aPoint) > 0.0)
139
return
INSIDE
;
140
else
141
if
(this->
operator
()(aPoint) < 0.0)
142
return
OUTSIDE
;
143
else
144
return
ON
;
145
}
146
147
154
inline
155
RealPoint
getLowerBound
()
const
156
{
157
return
(
myCenter
-
RealPoint::diagonal
(
myHalfWidth
));
158
}
159
166
inline
167
RealPoint
getUpperBound
()
const
168
{
169
return
(
myCenter
+
RealPoint::diagonal
(
myHalfWidth
));
170
}
171
175
RealPoint
center
()
const
176
{
177
return
myCenter
;
178
}
179
184
inline
185
void
moveTo
(
const
RealPoint
& newCenter )
186
{
187
myCenter
= newCenter;
188
}
189
190
// ----------------------- Interface --------------------------------------
191
public
:
192
197
void
selfDisplay
( std::ostream & out )
const
;
198
203
bool
isValid
()
const
;
204
205
// ------------------------- Protected Data ------------------------------
206
private
:
207
// ------------------------- Private Data --------------------------------
208
private
:
209
211
RealPoint
myCenter
;
212
214
double
myHalfWidth
;
215
217
double
myPower
;
218
219
// ------------------------- Hidden services ------------------------------
220
protected
:
221
226
ImplicitRoundedHyperCube
();
227
228
private
:
229
236
ImplicitRoundedHyperCube
&
operator=
(
const
ImplicitRoundedHyperCube
& other );
237
238
239
};
// end of class ImplicitRoundedHyperCube
240
241
248
template
<
typename
T>
249
std::ostream&
250
operator<<
( std::ostream & out,
const
ImplicitRoundedHyperCube<T>
&
object
);
251
252
}
// namespace DGtal
253
254
256
// Includes inline functions.
257
#include "DGtal/shapes/implicit/ImplicitRoundedHyperCube.ih"
258
259
// //
261
262
#endif
// !defined ImplicitRoundedHyperCube_h
263
264
#undef ImplicitRoundedHyperCube_RECURSES
265
#endif
// else defined(ImplicitRoundedHyperCube_RECURSES)
DGtal::ImplicitRoundedHyperCube
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a rounded hypercu...
Definition
ImplicitRoundedHyperCube.h:63
DGtal::ImplicitRoundedHyperCube::moveTo
void moveTo(const RealPoint &newCenter)
Definition
ImplicitRoundedHyperCube.h:185
DGtal::ImplicitRoundedHyperCube::ImplicitRoundedHyperCube
ImplicitRoundedHyperCube(const RealPoint &aCenter, const double &aHalfWidth, const double aPower)
Definition
ImplicitRoundedHyperCube.h:79
DGtal::ImplicitRoundedHyperCube::getUpperBound
RealPoint getUpperBound() const
Definition
ImplicitRoundedHyperCube.h:167
DGtal::ImplicitRoundedHyperCube::isInside
bool isInside(const RealPoint &aPoint) const
Definition
ImplicitRoundedHyperCube.h:123
DGtal::ImplicitRoundedHyperCube::operator()
double operator()(const RealPoint &aPoint) const
Definition
ImplicitRoundedHyperCube.h:106
DGtal::ImplicitRoundedHyperCube::getLowerBound
RealPoint getLowerBound() const
Definition
ImplicitRoundedHyperCube.h:155
DGtal::ImplicitRoundedHyperCube::isValid
bool isValid() const
DGtal::ImplicitRoundedHyperCube::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::ImplicitRoundedHyperCube::operator=
ImplicitRoundedHyperCube & operator=(const ImplicitRoundedHyperCube &other)
DGtal::ImplicitRoundedHyperCube::myCenter
RealPoint myCenter
Cube center.
Definition
ImplicitRoundedHyperCube.h:211
DGtal::ImplicitRoundedHyperCube::myHalfWidth
double myHalfWidth
Cube HalfWidth.
Definition
ImplicitRoundedHyperCube.h:214
DGtal::ImplicitRoundedHyperCube::Self
ImplicitRoundedHyperCube< TSpace > Self
Definition
ImplicitRoundedHyperCube.h:66
DGtal::ImplicitRoundedHyperCube::~ImplicitRoundedHyperCube
~ImplicitRoundedHyperCube()
DGtal::ImplicitRoundedHyperCube::center
RealPoint center() const
Definition
ImplicitRoundedHyperCube.h:175
DGtal::ImplicitRoundedHyperCube::Value
double Value
Definition
ImplicitRoundedHyperCube.h:69
DGtal::ImplicitRoundedHyperCube::ImplicitRoundedHyperCube
ImplicitRoundedHyperCube()
DGtal::ImplicitRoundedHyperCube::myPower
double myPower
Cube Power.
Definition
ImplicitRoundedHyperCube.h:217
DGtal::ImplicitRoundedHyperCube::Space
TSpace Space
Definition
ImplicitRoundedHyperCube.h:67
DGtal::ImplicitRoundedHyperCube::RealPoint
Space::RealPoint RealPoint
Definition
ImplicitRoundedHyperCube.h:68
DGtal::ImplicitRoundedHyperCube::orientation
Orientation orientation(const RealPoint &aPoint) const
Definition
ImplicitRoundedHyperCube.h:136
DGtal::PointVector< dim, double >::diagonal
static Self diagonal(Component val=1)
DGtal::PointVector< dim, double >::dimension
static const Dimension dimension
Definition
PointVector.h:626
DGtal::SpaceND< 3, Integer >::RealPoint
PointVector< dim, double > RealPoint
Definition
SpaceND.h:117
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::Dimension
DGtal::uint32_t Dimension
Definition
Common.h:119
DGtal::Orientation
Orientation
Definition
Common.h:124
DGtal::INSIDE
@ INSIDE
Definition
Common.h:124
DGtal::OUTSIDE
@ OUTSIDE
Definition
Common.h:124
DGtal::ON
@ ON
Definition
Common.h:124
aPoint
const Point aPoint(3, 4)
src
DGtal
shapes
implicit
ImplicitRoundedHyperCube.h
Generated on
for DGtal by
1.18.0