DGtal  1.3.beta
geometry/curves/estimation/exampleLMST3DBy2D.cpp

This example shows the basic usage of the Lambda maximal segment tangent estimation in 3D by the method using only 2D projections.

See also
Digital straight lines and segments
#include <iostream>
#include <iterator>
#include <vector>
#include "DGtal/base/Common.h"
#include "DGtal/base/BasicTypes.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/geometry/curves/estimation/LambdaMST3DBy2D.h"
using namespace std;
using namespace DGtal;
using namespace Z3i;
int main()
{
typedef vector < Point > Container;
typedef Container::const_iterator ConstIterator;
// Input points
Container contour;
contour.push_back ( Point ( 18, 25, 18 ) );
contour.push_back ( Point ( 17, 25, 19 ) );
contour.push_back ( Point ( 16, 25, 20 ) );
contour.push_back ( Point ( 15, 25, 21 ) );
contour.push_back ( Point ( 14, 25, 22 ) );
contour.push_back ( Point ( 13, 25, 23 ) );
contour.push_back ( Point ( 12, 25, 24 ) );
contour.push_back ( Point ( 11, 25, 25 ) );
contour.push_back ( Point ( 10, 25, 26 ) );
contour.push_back ( Point ( 9, 25, 27 ) );
contour.push_back ( Point ( 8, 25, 28 ) );
lmst.init ( contour.cbegin ( ), contour.cend ( ), LambdaMST3DBy2D < ConstIterator >::MAIN_AXIS::X ) ;
for ( const auto & p : contour )
trace.info ( ) << lmst.eval ( p ) << std::endl;
lmst.init ( contour.cbegin ( ), contour.cend ( ), LambdaMST3DBy2D < ConstIterator >::MAIN_AXIS::X );
vector < RealVector > tangent;
lmst.eval ( contour.cbegin ( ), contour.cend ( ), back_insert_iterator < vector < RealVector > > ( tangent ) );
for ( const auto & t : tangent )
trace.info ( ) << t << std::endl;
return 0;
}
// //
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition: greedy-plane-segmentation-ex2.cpp:93
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::LambdaMST3DBy2DEstimator< Iterator3D, TangentFromDSS3DBy2DFunctor, functors::Lambda64Function, 8 >::init
void init(Iterator3D itB, Iterator3D itE, MAIN_AXIS axis)
DGtal::Trace::info
std::ostream & info()
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::LambdaMST3DBy2D
Aim: Simplify creation of Lambda MST tangent estimator.
Definition: LambdaMST3DBy2D.h:157
main
int main(int argc, char **argv)
Definition: testArithmeticDSS-benchmark.cpp:147
DGtal::LambdaMST3DBy2DEstimator< Iterator3D, TangentFromDSS3DBy2DFunctor, functors::Lambda64Function, 8 >::eval
RealVector3D eval(const Point3D &point)
Point
MyPointD Point
Definition: testClone2.cpp:383