DGtal 1.3.0
Loading...
Searching...
No Matches
exampleLMST3DBy2D.cpp
1
42#include <iostream>
43#include <iterator>
44#include <vector>
45#include "DGtal/base/Common.h"
46#include "DGtal/base/BasicTypes.h"
47#include "DGtal/helpers/StdDefs.h"
48
50#include "DGtal/geometry/curves/estimation/LambdaMST3DBy2D.h"
53
54
55using namespace std;
56using namespace DGtal;
57using namespace Z3i;
58
60
61int main()
62{
64 typedef vector < Point > Container;
65 typedef Container::const_iterator ConstIterator;
66 LambdaMST3DBy2D < ConstIterator > lmst;
68
69 // Input points
70 Container contour;
71 contour.push_back ( Point ( 18, 25, 18 ) );
72 contour.push_back ( Point ( 17, 25, 19 ) );
73 contour.push_back ( Point ( 16, 25, 20 ) );
74 contour.push_back ( Point ( 15, 25, 21 ) );
75 contour.push_back ( Point ( 14, 25, 22 ) );
76 contour.push_back ( Point ( 13, 25, 23 ) );
77 contour.push_back ( Point ( 12, 25, 24 ) );
78 contour.push_back ( Point ( 11, 25, 25 ) );
79 contour.push_back ( Point ( 10, 25, 26 ) );
80 contour.push_back ( Point ( 9, 25, 27 ) );
81 contour.push_back ( Point ( 8, 25, 28 ) );
82
83 lmst.init ( contour.cbegin ( ), contour.cend ( ), LambdaMST3DBy2D < ConstIterator >::MAIN_AXIS::X ) ;
85 for ( const auto & p : contour )
86 trace.info ( ) << lmst.eval ( p ) << std::endl;
88
90 lmst.init ( contour.cbegin ( ), contour.cend ( ), LambdaMST3DBy2D < ConstIterator >::MAIN_AXIS::X );
91 vector < RealVector > tangent;
92 lmst.eval ( contour.cbegin ( ), contour.cend ( ), back_insert_iterator < vector < RealVector > > ( tangent ) );
94 for ( const auto & t : tangent )
95 trace.info ( ) << t << std::endl;
96 return 0;
97}
98// //
void init(Iterator3D itB, Iterator3D itE, MAIN_AXIS axis)
RealVector3D eval(const Point3D &point)
std::ostream & info()
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:154
STL namespace.
int main(int argc, char **argv)