33#include "DGtal/base/Common.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/io/viewers/PolyscopeViewer.h"
36#include "DGtal/geometry/tools/SphericalAccumulator.h"
46void testSphericalViewer()
48 trace.beginBlock (
"Testing Spherical Accumulator Viewer..." );
53 trace.info()<< accumulator << std::endl;
55 for(
unsigned int i=0; i< 10000; i++)
56 accumulator.addDirection(
Vector (1+10.0*(rand()-RAND_MAX/2)/(
double)RAND_MAX,
57 (1+10.0*(rand()-RAND_MAX/2))/(
double)RAND_MAX,
58 (1+10.0*(rand()-RAND_MAX/2))/(
double)RAND_MAX));
62 viewer << accumulator;
64 trace.info() <<
"Bin values: ";
68 trace.info() << *it<<
" ";
69 trace.info() << std::endl;
70 trace.info() << accumulator<<std::endl;
72 trace.emphase() <<
"Passed." << endl;
77void testSphericalViewerInteger()
79 trace.beginBlock (
"Testing Spherical Accumulator Viewer with Integer numbers..." );
84 trace.info()<< accumulator << std::endl;
86 for(
unsigned int i=0; i< 10000; i++)
87 accumulator.addDirection(
Vector (1+(rand()-RAND_MAX/2),
88 (1+(rand()-RAND_MAX/2)),
89 (1+(rand()-RAND_MAX/2))));
92 viewer << accumulator;
95 trace.info() <<
"Bin values: ";
99 trace.info() << *it<<
" ";
100 trace.info() << std::endl;
101 trace.info() << accumulator<<std::endl;
103 trace.emphase() <<
"Passed." << endl;
111int main(
int argc,
char** argv )
113 trace.beginBlock (
"Testing class SphericalAccumulator" );
114 trace.info() <<
"Args:";
115 for (
int i = 0; i < argc; ++i )
116 trace.info() <<
" " << argv[ i ];
117 trace.info() << endl;
119 testSphericalViewer();
120 testSphericalViewerInteger();
121 trace.emphase() <<
"Passed." << endl;
void show() override
Starts the event loop and display of elements.
Aim: implements an accumulator (as histograms for 1D scalars) adapted to spherical point samples.
std::vector< Quantity >::const_iterator ConstIterator
Type to iterate on bin values.
Z3i this namespace gathers the standard of types for 3D imagery.
Space::RealVector RealVector
DGtal is the top-level namespace which contains all DGtal functions and types.