45 #include "ConfigExamples.h"
46 #include "DGtal/helpers/StdDefs.h"
47 #include "DGtal/base/Common.h"
49 #include "DGtal/geometry/curves/AlphaThickSegmentComputer.h"
50 #include "DGtal/geometry/curves/SaturatedSegmentation.h"
51 #include "DGtal/base/Circulator.h"
54 #include "DGtal/geometry/curves/SegmentComputerUtils.h"
58 #include "DGtal/io/boards/Board2D.h"
63 using namespace DGtal;
69 trace.
beginBlock (
"Example of AlphaThickSegment tangential cover obtained from SaturatedSegmentation" );
72 typedef std::vector<Z2i::RealPoint>::const_iterator RAConstIterator;
80 std::string file = examplesPath +
"samples/contourSnoisy.sdp";
84 aBoard <<
SetMode(aContour[0].className(),
"Grid");
85 aBoard2 <<
SetMode(aContour[0].className(),
"Grid");
86 std::vector<LibBoard::Point> poly;
87 for (
unsigned int i = 0; i< aContour.size(); i++) poly.push_back(
LibBoard::Point(aContour[i][0], aContour[i][1]));
98 AlphaThickSegmentComputer2D computer(4, functions::Hull2D::EuclideanThickness);
99 AlphaSegmentation segmentator(circulator, circulator, computer);
103 AlphaSegmentation::SegmentComputerIterator i = segmentator.begin();
104 AlphaSegmentation::SegmentComputerIterator end = segmentator.end();
106 for ( ; i != end; ++i) {
107 AlphaThickSegmentComputer2D current(*i);
108 aBoard <<
SetMode(current.className(),
"BoundingBox");
112 aBoard.
saveEPS(
"exampleAlphaThickSegmentTgtCover.eps");
115 trace.
beginBlock (
"Example of AlphaThickSegment tangential cover obtained for a single point" );
120 unsigned int index = 80;
122 AlphaThickSegmentComputer2D first (computer);
124 AlphaThickSegmentComputer2D last (computer);
128 aBoard2.
fillCircle((*(circulator+index))[0], (*(circulator+index))[1], 1.0);
130 while(first.end() != last.end()){
131 aBoard2 <<
SetMode(first.className(),
"BoundingBox");
139 name <<
"exampleAlphaThickSegmentTgtCoverPoint" << index<<
".eps";
140 aBoard2.
saveEPS(name.str().c_str());