41#include "DGtal/base/Common.h"
42#include "DGtal/helpers/StdDefs.h"
43#include "ConfigExamples.h"
45#include "DGtal/geometry/tools/Preimage2D.h"
46#include "DGtal/shapes/fromPoints/StraightLineFrom2Points.h"
47#include "DGtal/shapes/fromPoints/CircleFrom2Points.h"
49#include "DGtal/io/boards/Board2D.h"
59int main(
int argc,
char** argv )
61 trace.beginBlock (
"Example for Preimage computation" );
62 trace.info() <<
"Args:";
63 for (
int i = 0; i < argc; ++i )
64 trace.info() <<
" " << argv[ i ];
67 std::string filename = examplesPath +
"samples/DSS.dat";
69 instream.open (filename.c_str(), ifstream::in);
75 trace.beginBlock(
"Simple preimage example");
79 StraightLine aStraightLine;
90 Preimage2D thePreimage(it->first, it->second, aStraightLine);
92 while ( (it != itEnd) &&
93 (thePreimage.
addFront(it->first, it->second)) )
97 trace.info() << thePreimage << endl;
101 board << r << thePreimage;
102 board.
saveEPS(
"PreimageExample.eps" );
109 trace.beginBlock(
"Preimage example with circles");
114 Circle aCircle( pole );
123 Preimage2D thePreimage(it->first, it->second, aCircle);
125 while ( (it != itEnd) &&
126 (thePreimage.
addFront(it->first, it->second)) )
130 trace.info() << thePreimage << endl;
135 board.
saveEPS(
"PreimageExample2.eps" );
136 board.
saveSVG(
"PreimageExample2.svg" );
137#ifdef DGTAL_WITH_CAIRO
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: Represents a circle that passes through a given point and that is thus uniquely defined by two o...
ConstIterator begin() const
ConstIterator end() const
bool initFromVectorStream(std::istream &in)
IncidentPointsRange getIncidentPointsRange() const
ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToIncidentPoints< KSpace >, std::pair< Point, Point > > IncidentPointsRange
Storage::const_iterator ConstIterator
std::string className() const
Aim: Computes the preimage of the 2D Euclidean shapes crossing a sequence of n straigth segments in O...
bool addFront(const Point &aP, const Point &aQ)
Aim: Represents a straight line uniquely defined by two 2D points and that is able to return for any ...
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....