42#include "DGtal/base/Common.h"
43#include "DGtal/helpers/StdDefs.h"
44#include "DGtal/io/boards/Board2D.h"
47#include "DGtal/geometry/curves/ArithmeticalDSS.h"
62 trace.beginBlock (
"Naive DSS" );
76 trace.info() << segment << std::endl;
91 trace.info() << std::endl;
102 board <<
SetMode(
"PointVector",
"Both");
113 board.
saveSVG(
"NaiveDSS8.svg");
114#ifdef DGTAL_WITH_CAIRO
128 trace.beginBlock (
"Standard DSS" );
142 trace.info() << segment << std::endl;
154 board <<
SetMode(
"PointVector",
"Grid")
164 board.
saveSVG(
"StandardDSS4.svg");
165#ifdef DGTAL_WITH_CAIRO
176 board <<
SetMode(
"PointVector",
"Both");
185 board.
saveSVG(
"StandardDSS4bis.svg");
186#ifdef DGTAL_WITH_CAIRO
199 trace.beginBlock (
"DSSs constructions" );
209 trace.info() << segment << std::endl;
217 trace.info() << segment << std::endl;
225 trace.info() << segment << std::endl;
234 trace.info() << segment << std::endl;
237 std::vector<Point> r;
247 if (!segment.
isValid())
throw std::exception();
249 trace.info() << segment << std::endl;
252 std::copy( segment.
begin(), segment.
end(), std::back_inserter(r) );
260 trace.info() << segment << std::endl;
272 trace.beginBlock (
"DSS update" );
287 if (!S.
isValid())
throw std::exception();
291 trace.info() << S << std::endl;
303 board <<
SetMode(
"PointVector",
"Both");
312 board <<
SetMode(M.className(),
"Both")
318 board.
saveSVG(
"NaiveDSS8ExtInit.svg");
319#ifdef DGTAL_WITH_CAIRO
329 if (!resExtention)
throw std::exception();
331 trace.info() << S << std::endl;
342 board <<
SetMode(
"PointVector",
"Both");
352 board.
saveSVG(
"NaiveDSS8ExtDone.svg");
353#ifdef DGTAL_WITH_CAIRO
363 if (!resRetraction)
throw std::exception();
365 trace.info() << S << std::endl;
370 if ( !S.
equalsTo(copyOfS) )
throw std::exception();
378int main(
int argc,
char** argv )
380 trace.beginBlock (
"Example exampleArithmeticalDSS" );
381 trace.info() <<
"Args:";
382 for (
int i = 0; i < argc; ++i )
383 trace.info() <<
" " << argv[ i ];
384 trace.info() << endl;
378int main(
int argc,
char** argv ) {
…}
std::string className() const
bool equalsTo(const ArithmeticalDSS &aOther) const
Position position(const Point &aPoint) const
Integer remainder(const Point &aPoint) const
ConstIterator begin() const
bool extendFront(const Point &aNewPoint)
ConstIterator end() const
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
Aim: This class is an alias of ArithmeticalDSS for naive DSL. It represents a naive digital straight ...
Aim: This class represents a standard digital straight segment (DSS), ie. the sequence of simply 8-co...
Aim: This class represents a standard digital straight segment (DSS), ie. the sequence of simply 4-co...
void clear(const DGtal::Color &color=DGtal::Color::None)
void drawArrow(double x1, double y1, double x2, double y2, bool filled=true, int depthValue=-1)
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
void exampleUpdate()
Function showing how a DSS can be extended and retracted.
void exampleNaiveDSS()
Function that illustrates the basic usage of a naive DSS.
void exampleStandardDSS()
Function that illustrates the basic usage of a standard DSS.
void exampleConstructors()
Function showing the different ways of constructing DSSs.
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....