32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
35 #include "ConfigExamples.h"
36 #include "DGtal/io/boards/Board2D.h"
37 #include "DGtal/geometry/curves/FrechetShortcut.h"
38 #include "DGtal/geometry/curves/GreedySegmentation.h"
42 using namespace DGtal;
50 int main(
int argc,
char** argv )
54 for (
int i = 0; i < argc; ++i )
58 std::string filename = examplesPath +
"samples/plant-frechet.dat";
60 instream.open (filename.c_str(), ifstream::in);
63 double error = atof(argv[1]);
67 c.initFromVectorStream(instream);
72 board << c.getArrowsRange();
77 Curve::PointsRange r = c.getPointsRange();
85 while ( ( s.end() != r.end() )
86 &&( s.extendForward() ) ) {}
94 Segmentation theSegmentation( r.begin(), r.end(), Shortcut(error) );
97 Segmentation::SegmentComputerIterator it = theSegmentation.
begin();
98 Segmentation::SegmentComputerIterator itEnd = theSegmentation.
end();
100 for ( ; it != itEnd; ++it) {
106 board.
saveEPS(
"FrechetShortcutExample.eps", Board2D::BoundingBox, 5000 );