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"
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;
77 std::vector<Z2i::Point> aContour3;
87 std::vector<Z2i::Point> res, res2;
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];
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;
116int main(
int argc,
char** argv )
120 for (
int i = 0; i < argc; ++i )
125 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
static DGtal::PointVector< TPoint::dimension, double > getBarycenter(const std::vector< TPoint > &aSet)
static void pixels2pixels8C(const TIterator &itb, const TIterator &ite, TOutputIterator out)
static bool isCounterClockWise(const std::vector< TPoint > &aCurve)
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.