DGtal  0.9.2
exampleNaive3DDSSComputer.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/Naive3DDSSComputer.h"
40 
41 
42 using namespace std;
43 using namespace DGtal;
44 
46 
47 int main()
48 {
49  using namespace Z3i;
50 
52  // Container of digital points
53  typedef std::vector<Z3::Point> Container;
54  // Iterator on the container
55  typedef Container::const_iterator ConstIterator;
56  // Naive3DDSS computer
58  // Construction of the computer
59  DSSComputer theDSSComputer;
61 
62  // Input points
63  Container contour;
64  contour.push_back(Z3::Point(18,25,18));
65  contour.push_back(Z3::Point(17,25,19));
66  contour.push_back(Z3::Point(16,25,20));
67  contour.push_back(Z3::Point(15,25,21));
68  contour.push_back(Z3::Point(14,25,22));
69  contour.push_back(Z3::Point(13,25,23));
70  contour.push_back(Z3::Point(12,25,24));
71  contour.push_back(Z3::Point(11,25,25));
72  contour.push_back(Z3::Point(10,25,26));
73  contour.push_back(Z3::Point(9,25,27));
74  contour.push_back(Z3::Point(8,25,28));
75 
77  // Add points while it is possible
78  theDSSComputer.init( contour.begin() );
79  while ( ( theDSSComputer.end() != contour.end() ) &&
80  ( theDSSComputer.extendFront() ) ) {}
82 
83  // Trace to the standard output
84  theDSSComputer.selfDisplay( cout );
85 
87  theDSSComputer.validArithmeticalDSS2d( 0 );
89 
91  DSSComputer::ArithmeticalDSSComputer2d theDSS = theDSSComputer.arithmeticalDSS2d( 0 );
93 
94 
96  DSSComputer::Point3d directionZ3;
97  DSSComputer::PointR3d intercept;
98  DSSComputer::PointR3d thikness;
99  theDSSComputer.getParameters ( directionZ3, intercept, thikness );
101 
102  return 1;
103 }
104 // //
STL namespace.
void init(const ConstIterator &it)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)