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
geometry
curves
estimation
TrueGlobalEstimatorOnPoints.ih
1
30
31
#include <cstdlib>
33
35
// IMPLEMENTATION of inline methods.
37
39
// ----------------------- Standard services ------------------------------
40
41
45
template
<
typename
CIt,
typename
PShape,
typename
PShapeFunctor>
46
inline
47
DGtal::TrueGlobalEstimatorOnPoints<CIt,PShape,PShapeFunctor>::TrueGlobalEstimatorOnPoints
(
const
double
h,
48
const
ConstIteratorOnPoints& itb,
49
const
ConstIteratorOnPoints& ite,
50
PShape* aShape,
51
const
bool
& isClosed)
52
{
53
init(h,itb,ite,aShape,isClosed);
54
}
55
59
template
<
typename
CIt,
typename
PShape,
typename
PShapeFunctor>
60
inline
61
void
62
DGtal::TrueGlobalEstimatorOnPoints<CIt,PShape,PShapeFunctor>::init
(
const
double
h,
63
const
ConstIteratorOnPoints
& itb,
64
const
ConstIteratorOnPoints
& ite,
65
PShape* aShape,
66
const
bool
& isClosed)
67
{
68
myH = h;
69
70
myBegin = itb;
71
myEnd = ite;
72
73
myFlagIsClosed = isClosed;
74
myFlagIsInit =
true
;
75
76
myFunctor =
ParametricShapeFunctor
(aShape);
77
78
}
79
84
template
<
typename
CIt,
typename
PShape,
typename
PShapeFunctor>
85
inline
86
typename
DGtal::TrueGlobalEstimatorOnPoints<CIt,PShape,PShapeFunctor>::Quantity
87
DGtal::TrueGlobalEstimatorOnPoints<CIt,PShape,PShapeFunctor>::eval
()
88
{
89
ASSERT(myH>0);
90
if
(myFlagIsClosed) {
91
return
myFunctor();
92
}
else
{
93
//get the first and last points
94
ConstIteratorOnPoints
i = myBegin;
95
ConstIteratorOnPoints
j(i); ++j;
96
for
( ; j != myEnd ; ++i, ++j) {}
97
//myH is the coordinates unit
98
RealPoint
p( *myBegin );
99
p *= myH;
100
RealPoint
p2( *i );
101
p2 *= myH;
102
return
myFunctor(p,p2);
103
}
104
}
105
106
110
template
<
typename
CIt,
typename
PShape,
typename
PShapeFunctor>
111
inline
112
typename
DGtal::TrueGlobalEstimatorOnPoints<CIt,PShape,PShapeFunctor>::Quantity
113
DGtal::TrueGlobalEstimatorOnPoints<CIt,PShape,PShapeFunctor>::eval
(
const
ConstIteratorOnPoints
& itb,
114
const
ConstIteratorOnPoints
& ite)
115
{
116
ASSERT(myH>0);
117
if
(myFlagIsClosed) {
118
return
myFunctor();
119
}
else
{
120
//get the first and last points
121
ConstIteratorOnPoints
i = itb;
122
ConstIteratorOnPoints
j(i); ++j;
123
for
( ; j != ite; ++i, ++j) {};
124
//myH is the coordinates unit
125
RealPoint
p( *itb );
126
p *= myH;
127
RealPoint
p2( *i );
128
p2 *= myH;
129
return
myFunctor(p,p2);
130
}
131
}
132
133
138
template
<
typename
CIt,
typename
PShape,
typename
PShapeFunctor>
139
inline
140
bool
141
DGtal::TrueGlobalEstimatorOnPoints<CIt,PShape,PShapeFunctor>::isValid
()
const
142
{
143
return
myFlagIsInit;
144
}
145
146
Generated on Wed Dec 19 2012 19:10:42 for DGtal by
1.8.1.1