DGtal  0.9.3beta
exampleArithmeticalDSSComputer.cpp
1 
30 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/base/BasicTypes.h"
34 #include "DGtal/helpers/StdDefs.h"
35 
37 #include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
40 
41 
42 using namespace std;
43 using namespace DGtal;
44 
46 
47 int main()
48 {
49 
50 
51  using namespace Z2i;
52 
54  // Container of digital points
55  typedef std::vector<Z2::Point> Container;
56  // Iterator on the container
57  typedef Container::const_iterator ConstIterator;
58  // StandardDSS4 computer
59  typedef StandardDSS4Computer<ConstIterator> DSSComputer;
60  // Construction of the computer
61  DSSComputer theDSSComputer;
63 
64  // Input points
65  Container contour;
66  contour.push_back(Z2::Point(0,0));
67  contour.push_back(Z2::Point(1,0));
68  contour.push_back(Z2::Point(1,1));
69  contour.push_back(Z2::Point(2,1));
70  contour.push_back(Z2::Point(3,1));
71  contour.push_back(Z2::Point(3,2));
72  contour.push_back(Z2::Point(4,2));
73  contour.push_back(Z2::Point(5,2));
74  contour.push_back(Z2::Point(6,2));
75  contour.push_back(Z2::Point(6,3));
76  contour.push_back(Z2::Point(6,4));
77 
79  // Add points while it is possible
80  theDSSComputer.init( contour.begin() );
81  while ( ( theDSSComputer.end() != contour.end() ) &&
82  ( theDSSComputer.extendFront() ) ) {}
84 
85  // Trace to the standard output
86  cout << theDSSComputer << endl;
87 
89  DSSComputer::Primitive theDSS = theDSSComputer.primitive();
91 
92  // Trace to the standard output
93  cout << theDSS << endl;
94 
95  return 1;
96 }
97 // //
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of sta...
void init(const ConstIterator &it)
STL namespace.
DGtal is the top-level namespace which contains all DGtal functions and types.