DGtal  0.9.2
exampleArithDSSIterator.cpp
1 
30 #include <iostream>
32 #include "ConfigExamples.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/base/Common.h"
36 
37 #include "DGtal/geometry/curves/ArithDSSIterator.h"
38 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
39 
40 
41 using namespace std;
42 using namespace DGtal;
43 
45 
46 int main( int UNUSED(argc), char** UNUSED(argv) )
47 {
48  trace.beginBlock ( "Example exampleArithDSSIterator" );
49 
50  typedef Z2i::Integer Integer;
51  typedef ArithDSSIterator<Integer,8> DSSIterator;
53  typedef Z2i::Point Point;
54 
55  Point A(1,5);
56  Integer xMax = 6;
57 
58  // Define an iterator over the 8-connected DSS of characteristics
59  // (2,3,15) and initial point A
60  DSSIterator it(2,3,-15,A);
61 
62  // Use this iterator in the ArithmeticalDSS recognition algorithm.
63  // The result gives the minimal characteristics of the subsegment of
64  // the DSL (2,3,15) between the point A and the point of abscissa
65  // equal to xMax.
66  ArithDSS myDSS(it);
67 
68  while ( (*(myDSS.end()))[0] <=xMax && myDSS.extendFront())
69  {}
70 
71  //Display the result.
72  std::cout << myDSS.a() << " " << myDSS.b() << " " << myDSS.mu();
73 
74  trace.endBlock();
75  return 0;
76 }
77 // //
void beginBlock(const std::string &keyword="")
DGtal::int32_t Integer
Definition: StdDefs.h:74
Trace trace
Definition: Common.h:130
STL namespace.
double endBlock()
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: An iterator on the points of a Digital Straight Segment. Template parameters are the integer typ...