32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/geometry/tools/SphericalAccumulator.h"
38 using namespace DGtal;
46 #include <QtGui/qapplication.h>
47 #include "DGtal/io/viewers/Viewer3D.h"
48 bool testSphericalViewer(
int argc,
char **argv)
50 QApplication application(argc,argv);
59 for(
unsigned int i=0; i< 10000; i++)
60 accumulator.addDirection( Vector (1+10.0*(rand()-RAND_MAX/2)/(
double)RAND_MAX,
61 (1+10.0*(rand()-RAND_MAX/2))/(
double)RAND_MAX,
62 (1+10.0*(rand()-RAND_MAX/2))/(
double)RAND_MAX));
67 viewer << accumulator;
77 viewer << Viewer3D::updateDisplay;
78 bool res = application.exec();
79 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
83 bool testSphericalViewerInteger(
int argc,
char **argv)
85 QApplication application(argc,argv);
87 trace.
beginBlock (
"Testing Spherical Accumulator Viewer with Integer numbers..." );
94 for(
unsigned int i=0; i< 10000; i++)
95 accumulator.addDirection( Vector (1+(rand()-RAND_MAX/2),
96 (1+(rand()-RAND_MAX/2)),
97 (1+(rand()-RAND_MAX/2))));
102 Display3DFactory::draw(viewer,accumulator,
Z3i::RealVector(1.0,1.0,1.0), 3.0);
112 viewer << Viewer3D::updateDisplay;
113 bool res = application.exec();
114 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
122 int main(
int argc,
char** argv )
126 for (
int i = 0; i < argc; ++i )
130 bool res = testSphericalViewer(argc,argv)
131 && testSphericalViewerInteger(argc,argv);
132 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;