33 #include "DGtal/base/Common.h"
34 #include "DGtal/helpers/StdDefs.h"
35 #include "ConfigExamples.h"
37 #include "DGtal/geometry/tools/Preimage2D.h"
38 #include "DGtal/shapes/fromPoints/StraightLineFrom2Points.h"
39 #include "DGtal/shapes/fromPoints/CircleFrom2Points.h"
41 #include "DGtal/io/boards/Board2D.h"
46 using namespace DGtal;
51 int main(
int argc,
char** argv )
55 for (
int i = 0; i < argc; ++i )
59 std::string filename = examplesPath +
"samples/DSS.dat";
61 instream.open (filename.c_str(), ifstream::in);
64 c.initFromVectorStream(instream);
71 StraightLine aStraightLine;
77 Curve::IncidentPointsRange r = c.getIncidentPointsRange();
78 Curve::IncidentPointsRange::ConstIterator it (r.begin());
79 Curve::IncidentPointsRange::ConstIterator itEnd (r.end());
82 Preimage2D thePreimage(it->first, it->second, aStraightLine);
84 while ( (it != itEnd) &&
85 (thePreimage.addFront(it->first, it->second)) )
92 board.
setUnit(Board2D::UCentimeter);
93 board << r << thePreimage;
94 board.
saveEPS(
"PreimageExample.eps" );
102 Curve::Point pole(7,2);
106 Circle aCircle( pole );
110 Curve::IncidentPointsRange r = c.getIncidentPointsRange();
111 Curve::IncidentPointsRange::ConstIterator it (r.begin());
112 Curve::IncidentPointsRange::ConstIterator itEnd (r.end());
115 Preimage2D thePreimage(it->first, it->second, aCircle);
117 while ( (it != itEnd) &&
118 (thePreimage.addFront(it->first, it->second)) )
125 board.
setUnit(Board2D::UCentimeter);
126 board << r <<
SetMode(pole.className(),
"Grid") << pole << thePreimage;
127 board.
saveEPS(
"PreimageExample2.eps" );
128 board.
saveSVG(
"PreimageExample2.svg" );
130 board.saveCairo(
"PreimageExample2.pdf", Board2D::CairoPDF);