32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/geometry/tools/SphericalAccumulator.h"
38 using namespace DGtal;
46 unsigned int nbok = 0;
59 nbok += (accumulator.
samples() == 2) ? 1 : 0;
61 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
62 <<
"insert dirs" << std::endl;
68 nbok += (accumulator.
samples() == 0) ? 1 : 0;
70 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
71 <<
"clear" << std::endl;
80 trace.
info() <<
"Got coordinates ("<<i<<
","<<j<<
")"<<std::endl;
81 trace.
info() <<
"Count(i,j) = "<< accumulator.
count(i,j) <<std::endl;
82 nbok += (accumulator.
count(i,j) == 2) ? 1 : 0;
84 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
85 <<
"bin with 2dirs" << std::endl;
105 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
106 <<
"representative directions identical" << std::endl;
110 trace.
info() <<
"Coordinate from (it) = ("<<ii<<
","<<jj<<
")"<<std::endl;
111 nbok += (( i == ii) && (j==jj)) ? 1 : 0;
113 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
114 <<
"coordinates ok" << std::endl;
123 unsigned int nbok = 0;
126 trace.
beginBlock (
"Testing Spherical Accumulator with more points ..." );
162 unsigned int nbok = 0;
165 trace.
beginBlock (
"Testing Spherical Accumulator with more Integer points ..." );
190 trace.
info() <<
"Max bin= ("<<i<<
","<<j<<
")"<<std::endl;
194 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
195 <<
"Representative ok" << std::endl;
205 int main(
int argc,
char** argv )
209 for (
int i = 0; i < argc; ++i )
215 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: Implements basic operations that will be used in Point and Vector classes.
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.
ConstIterator begin() const
void maxCountBin(Size &posPhi, Size &posTheta) const
Quantity count(const Size &posPhi, const Size &posTheta) const
void binCoordinates(const Vector &aDir, Size &posPhi, Size &posTheta) const
ConstIterator end() const
size_t Size
Type to represent bin indexes.
Vector representativeDirection(const Size &posPhi, const Size &posTheta) const
void addDirection(const Vector &aDir)
void beginBlock(const std::string &keyword="")
DigitalPlane::Point Vector
DGtal is the top-level namespace which contains all DGtal functions and types.
HalfEdgeDataStructure::Size Size
int main(int argc, char **argv)
bool testSphericalMoreIntegerDir()
bool testSphericalAccumulator()