32 #include "DGtal/base/Common.h"
33 #include "ConfigTest.h"
34 #include "DGtal/geometry/helpers/ContourHelper.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/kernel/PointVector.h"
40 using namespace DGtal;
51 unsigned int nbok = 0;
54 trace.
beginBlock (
"Test ContourHelper: getgetBarycenter and isCounterClockWise" );
55 std::vector<Z2i::Point> aContour;
62 std::vector<Z2i::Point> aContour2;
69 nbok += ContourHelper::isCounterClockWise(aContour) ? 1 : 0;
71 nbok += ContourHelper::isCounterClockWise(aContour2) ? 0 : 1;
77 std::vector<Z2i::Point> aContour3;
87 std::vector<Z2i::Point> res, res2;
89 ContourHelper::pixels2pixels8C(aContour3.begin(),
90 aContour3.end(), std::back_inserter(res));
91 trace.
info() <<
"Apply pixels2pixels8c (from std::vector contour)init size : " << res.size() <<
" (should be: " << aContour3.size() -2 <<
" ) "<< std::endl;
92 trace.
info() <<
"Third point : " << res[2] <<
" (should be: " <<
Z2i::Point(2,1) <<
" ) "<< std::endl;
94 nbok += res.size() == aContour3.size() -2 ||
Z2i::Point(2,1)==res[2];
99 ContourHelper::pixels2pixels8C(gc.getPointsRange().begin(),
100 gc.getPointsRange().end(), std::back_inserter(res2));
101 trace.
info() <<
"Apply pixels2pixels8c (from GridCurve contour) init size : " << res2.size() <<
" (should be: " << aContour3.size() -2 <<
" ) "<< std::endl;
102 trace.
info() <<
"Third point : " << res2[2] <<
" (should be: " <<
Z2i::Point(2,1) <<
" ) "<< std::endl;
104 nbok += res2.size() == aContour3.size() -2 ||
Z2i::Point(2,1)==res2[2];
106 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "<< std::endl;
116 int main(
int argc,
char** argv )
120 for (
int i = 0; i < argc; ++i )
125 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
bool initFromPointsVector(const std::vector< Point > &aVectorOfPoints)
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)