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 Z3i;
{
typedef vector < Point > Container;
LambdaMST3DBy2D < ConstIterator > lmst;
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;
}
void init(Iterator3D itB, Iterator3D itE, MAIN_AXIS axis)
RealVector3D eval(const Point3D &point)
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.