DGtal 1.3.0
Loading...
Searching...
No Matches
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;
LambdaMST3DBy2D < ConstIterator > lmst;
// 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;
}
// //
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.
STL namespace.
int main()
Definition: testBits.cpp:56
MyPointD Point
Definition: testClone2.cpp:383