DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Astroid2D.h
1
16
17
#pragma once
18
30
31
#if defined(Astroid2D_RECURSES)
32
#error Recursive header files inclusion detected in Astroid2D.h
33
#else
// defined(Astroid2D_RECURSES)
35
#define Astroid2D_RECURSES
36
37
#if !defined Astroid2D_h
39
#define Astroid2D_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
45
#include "DGtal/shapes/parametric/StarShaped2D.h"
46
#include <cmath>
48
49
namespace
DGtal
50
{
51
53
// template class Astroid2D
60
template
<
typename
TSpace>
61
class
Astroid2D
:
public
StarShaped2D
<TSpace>
62
{
63
// ----------------------- Standard services ------------------------------
64
public
:
65
66
typedef
TSpace
Space
;
67
typedef
typename
Space::RealPoint
RealPoint
;
68
typedef
typename
Space::RealVector
RealVector
;
69
74
Astroid2D
() =
delete
;
75
84
Astroid2D
(
const
double
x0,
const
double
y0,
85
const
double
a,
const
double
b );
86
94
Astroid2D
(
const
RealPoint
&
aPoint
,
const
double
a,
const
double
b );
95
100
Astroid2D
(
const
Astroid2D
& other );
101
108
Astroid2D
&
operator=
(
const
Astroid2D
& other ) =
delete
;
109
113
~Astroid2D
() =
default
;
114
115
// ------------- Implementation of 'StarShaped' services -------------------
116
public
:
117
122
RealPoint
getLowerBound
()
const
123
{
124
return
RealPoint
(
myCenter
[0] -
myA
,
myCenter
[1] -
myB
);
125
}
126
131
RealPoint
getUpperBound
()
const
132
{
133
return
RealPoint
(
myCenter
[0] +
myA
,
myCenter
[1] +
myB
);
134
}
135
139
RealPoint
center
()
const
140
{
141
return
myCenter
;
142
}
143
148
inline
149
void
moveTo
(
const
RealPoint
& newCenter )
150
{
151
myCenter
= newCenter;
152
}
153
160
double
parameter
(
const
RealPoint
& p )
const
;
161
162
169
RealPoint
x
(
const
double
t )
const
;
170
177
RealVector
xp
(
const
double
t )
const
;
178
184
RealVector
xpp
(
const
double
t )
const
;
185
186
187
// ------------------------- data -----------------------------------------
188
private
:
189
193
RealPoint
myCenter
;
194
198
double
myA
;
199
203
double
myB
;
204
205
// ----------------------- Interface --------------------------------------
206
public
:
207
212
void
selfDisplay
( std::ostream & out )
const
;
213
214
219
bool
isValid
()
const
;
220
221
// ------------------------- Hidden services ------------------------------
222
private
:
223
227
template
<
typename
T>
228
inline
229
bool
isAlmostEqual
( T
x
, T y )
const
230
{
231
return
std::abs(
x
- y) <= std::numeric_limits<T>::epsilon();
232
}
233
234
};
// end of class Astroid2D
235
236
237
244
template
<
typename
T>
245
std::ostream&
246
operator<<
( std::ostream & out,
const
Astroid2D<T>
&
object
);
247
248
}
// namespace DGtal
249
250
252
// Includes inline functions.
253
#include "DGtal/shapes/parametric/Astroid2D.ih"
254
255
// //
257
258
#endif
// !defined Astroid2D_h
259
260
#undef Astroid2D_RECURSES
261
#endif
// else defined(Astroid2D_RECURSES)
DGtal::Astroid2D
Aim: Model of the concept StarShaped represents an astroid.
Definition
Astroid2D.h:62
DGtal::Astroid2D::operator=
Astroid2D & operator=(const Astroid2D &other)=delete
DGtal::Astroid2D::isValid
bool isValid() const
DGtal::Astroid2D::getLowerBound
RealPoint getLowerBound() const
Definition
Astroid2D.h:122
DGtal::Astroid2D::moveTo
void moveTo(const RealPoint &newCenter)
Definition
Astroid2D.h:149
DGtal::Astroid2D::xpp
RealVector xpp(const double t) const
DGtal::Astroid2D::x
RealPoint x(const double t) const
DGtal::Astroid2D::xp
RealVector xp(const double t) const
DGtal::Astroid2D::Astroid2D
Astroid2D()=delete
DGtal::Astroid2D::RealVector
Space::RealVector RealVector
Definition
Astroid2D.h:68
DGtal::Astroid2D< Space >::myA
double myA
Definition
Astroid2D.h:198
DGtal::Astroid2D::center
RealPoint center() const
Definition
Astroid2D.h:139
DGtal::Astroid2D< Space >::myCenter
RealPoint myCenter
Definition
Astroid2D.h:193
DGtal::Astroid2D::getUpperBound
RealPoint getUpperBound() const
Definition
Astroid2D.h:131
DGtal::Astroid2D::RealPoint
Space::RealPoint RealPoint
Definition
Astroid2D.h:67
DGtal::Astroid2D::Astroid2D
Astroid2D(const RealPoint &aPoint, const double a, const double b)
DGtal::Astroid2D::Astroid2D
Astroid2D(const double x0, const double y0, const double a, const double b)
DGtal::Astroid2D< Space >::myB
double myB
Definition
Astroid2D.h:203
DGtal::Astroid2D::Astroid2D
Astroid2D(const Astroid2D &other)
DGtal::Astroid2D::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::Astroid2D::isAlmostEqual
bool isAlmostEqual(T x, T y) const
Definition
Astroid2D.h:229
DGtal::Astroid2D::Space
TSpace Space
Definition
Astroid2D.h:66
DGtal::Astroid2D::~Astroid2D
~Astroid2D()=default
DGtal::Astroid2D::parameter
double parameter(const RealPoint &p) const
DGtal::SpaceND< 3, Integer >::RealPoint
PointVector< dim, double > RealPoint
Definition
SpaceND.h:117
DGtal::SpaceND< 3, Integer >::RealVector
PointVector< dim, double > RealVector
Definition
SpaceND.h:121
DGtal::StarShaped2D::StarShaped2D
StarShaped2D()=default
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)
aPoint
const Point aPoint(3, 4)
src
DGtal
shapes
parametric
Astroid2D.h
Generated on
for DGtal by
1.18.0