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
tools
SphericalAccumulator.h
1
17
#pragma once
18
31
#if defined(SphericalAccumulator_RECURSES)
32
#error Recursive header files inclusion detected in SphericalAccumulator.h
33
#else // defined(SphericalAccumulator_RECURSES)
34
35
#define SphericalAccumulator_RECURSES
36
37
#if !defined SphericalAccumulator_h
38
39
#define SphericalAccumulator_h
40
42
// Inclusions
43
#include <iostream>
44
#include <algorithm>
45
#include "DGtal/base/Common.h"
46
#include "DGtal/kernel/NumberTraits.h"
48
49
namespace
DGtal
50
{
51
53
// template class SphericalAccumulator
100
template
<
typename
TVector>
101
class
SphericalAccumulator
102
{
103
// ----------------------- Standard services ------------------------------
104
public
:
105
107
typedef
TVector
Vector
;
108
110
typedef
DGtal::int32_t
Quantity
;
111
113
typedef
DGtal::uint32_t
Size
;
114
116
typedef
std::vector<Quantity>::const_iterator
ConstIterator
;
117
119
typedef
PointVector<3,double>
RealVector
;
120
121
BOOST_STATIC_ASSERT
( Vector::dimension == 3);
122
132
SphericalAccumulator
(
const
Size
aNphi);
133
137
~SphericalAccumulator
();
138
139
// ----------------------- Interface --------------------------------------
140
public
:
141
148
void
addDirection
(
const
Vector
&aDir);
149
159
void
binCoordinates
(
const
Vector
&aDir,
160
Size
&posPhi,
161
Size
&posTheta)
const
;
162
172
Quantity
count
(
const
Size
&posPhi,
173
const
Size
&posTheta)
const
;
174
175
191
Vector
representativeDirection
(
const
Size
&posPhi,
192
const
Size
&posTheta)
const
;
193
202
Vector
representativeDirection
(
ConstIterator
&it)
const
;
203
204
210
Quantity
samples
()
const
;
211
216
Quantity
binNumber
()
const
{
return
myBinNumber
;}
217
218
226
void
maxCountBin
(
Size
&posPhi,
Size
&posTheta)
const
;
227
232
void
clear
();
233
234
239
void
selfDisplay
( std::ostream & out )
const
;
240
245
bool
isValid
()
const
;
246
251
std::string
className
()
const
252
{
253
return
"SphericalAccumulator"
;
254
}
255
256
265
bool
isValidBin
(
const
Size
&posPhi,
266
const
Size
&posTheta)
const
;
267
268
280
void
getBinGeometry
(
const
Size
&posPhi,
281
const
Size
&posTheta,
282
RealVector
&a,
283
RealVector
&b,
284
RealVector
&c,
285
RealVector
&d)
const
;
286
287
// ------------------------- Iterators ------------------------------
288
296
ConstIterator
begin
()
const
297
{
298
return
myAccumulator
.begin();
299
}
300
304
ConstIterator
end
()
const
305
{
306
return
myAccumulator
.end();
307
}
308
309
317
void
binCoordinates
(ConstIterator &aDir,
318
Size
&posPhi,
319
Size
&posTheta)
const
;
320
321
// ------------------------- Protected Datas ------------------------------
322
private
:
323
// ------------------------- Private Datas --------------------------------
324
private
:
325
327
Size
myNphi
;
328
330
Size
myNtheta
;
331
333
std::vector<Quantity>
myAccumulator
;
334
336
std::vector<Vector>
myAccumulatorDir
;
337
339
Quantity
myTotal
;
340
342
Quantity
myBinNumber
;
343
345
Size
myMaxBinPhi
;
346
348
Size
myMaxBinTheta
;
349
350
351
// ------------------------- Hidden services ------------------------------
352
protected
:
353
358
SphericalAccumulator
();
359
360
private
:
361
367
SphericalAccumulator
(
const
SphericalAccumulator
& other );
368
375
SphericalAccumulator
&
operator=
(
const
SphericalAccumulator
& other );
376
377
// ------------------------- Internals ------------------------------------
378
private
:
379
380
};
// end of class SphericalAccumulator
381
382
389
template
<
typename
T>
390
std::ostream&
391
operator<< ( std::ostream & out, const SphericalAccumulator<T> & object );
392
393
}
// namespace DGtal
394
395
397
// Includes inline functions.
398
#include "DGtal/geometry/tools//SphericalAccumulator.ih"
399
400
// //
402
403
#endif // !defined SphericalAccumulator_h
404
405
#undef SphericalAccumulator_RECURSES
406
#endif // else defined(SphericalAccumulator_RECURSES)
Generated on Wed Dec 19 2012 19:10:35 for DGtal by
1.8.1.1