32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/geometry/tools/SphericalAccumulator.h"
35 #include "DGtal/io/viewers/Viewer3D.h"
36 #include "DGtal/io/boards/Board3D.h"
40 using namespace DGtal;
46 bool testSphericalViewer(
int argc,
char **argv)
48 QApplication application(argc,argv);
57 for(
unsigned int i=0; i< 10000; i++)
58 accumulator.addDirection(
Vector (1+10.0*(rand()-RAND_MAX/2)/(
double)RAND_MAX,
59 (1+10.0*(rand()-RAND_MAX/2))/(
double)RAND_MAX,
60 (1+10.0*(rand()-RAND_MAX/2))/(
double)RAND_MAX));
66 viewer << accumulator;
70 board.
saveOBJ(
"testSpherical.obj");
81 viewer << Viewer3D<>::updateDisplay;
82 bool res = application.exec();
83 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
87 bool testSphericalViewerInteger(
int argc,
char **argv)
89 QApplication application(argc,argv);
91 trace.
beginBlock (
"Testing Spherical Accumulator Viewer with Integer numbers..." );
98 for(
unsigned int i=0; i< 10000; i++)
99 accumulator.addDirection(
Vector (1+(rand()-RAND_MAX/2),
100 (1+(rand()-RAND_MAX/2)),
101 (1+(rand()-RAND_MAX/2))));
116 viewer << Viewer3D<>::updateDisplay;
117 bool res = application.exec();
118 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
126 int main(
int argc,
char** argv )
130 for (
int i = 0; i < argc; ++i )
134 bool res = testSphericalViewer(argc,argv)
135 && testSphericalViewerInteger(argc,argv);
136 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;