29#if defined(FunctorsLambdaMST_RECURSES)
30#error Recursive header files inclusion detected in FunctorsLambdaMST.h
33#define FunctorsLambdaMST_RECURSES
35#if !defined FunctorsLambdaMST_h
37#define FunctorsLambdaMST_h
44#include "DGtal/base/Common.h"
45#include "DGtal/base/IteratorCirculatorTraits.h"
46#include "DGtal/base/CUnaryFunctor.h"
74 return 64.0 * ( -e3 * e3 + 3.0 * e3 * e2 - 3.0 * e2 * e2 + e3 );
86 return std::sin ( M_PI * x );
99 return 2.0 / ( std::exp ( 15.0 * ( x - 0.5 ) ) + std::exp ( -15.0 * ( x - 0.5 ) ) );
111template<
typename DSS,
typename LambdaFunction>
127 this->first +=
ch.first;
128 this->second +=
ch.second;
146 double norm = std::sqrt ( aDSS.a() * aDSS.a() + aDSS.b() * aDSS.b() );
147 result.second =
lambdaFunctor ( (
double)indexOfPointInDSS / (
double)dssLen );
150 result.first[0] = result.second * aDSS.b() / norm;
151 result.first[1] = result.second * aDSS.a() / norm;
155 result.first[0] = 0.;
156 result.first[1] = 0.;
172template<
typename DSS,
typename LambdaFunction>
187 this->first +=
ch.first;
188 this->second +=
ch.second;
201 Value operator() (
const TDSS& aDSS,
const unsigned int indexOfPointInDSS,
const unsigned int dssLen )
const
204 typename DSS::Point3d directionZ3;
206 typename DSS::PointR3d intercept;
207 typename DSS::PointR3d thikness;
209 aDSS.getParameters ( directionZ3, intercept, thikness );
210 direction[0] = directionZ3[0];
211 direction[1] = directionZ3[1];
212 direction[2] = directionZ3[2];
214 result.second =
lambdaFunctor ( (
double)indexOfPointInDSS / (
double)dssLen );
216 double norm = direction.
norm();
219 result.first = direction * result.second;
234template<
typename DSS >
257 throw std::runtime_error (
"You are not suppose to see this error!" );
268template<
typename DSS >
283 if ( threshold < 0. )
284 throw std::runtime_error (
"The threshold has to be positive!" );
296 throw std::runtime_error (
"The filter has to be initialized!" );
298 return std::distance ( dss.begin ( ), dss.end ( ) ) <
lenThreshold;
323 else if ( ( p - *( dss.end ( ) - 1 ) ).norm ( ) <=
lenThreshold )
324 return std::distance ( dss.begin ( ), dss.end ( ) ) + 1;
326 throw std::runtime_error (
"The DSS and the point are not admissible!" );
341#undef FunctorsLambdaMST_RECURSES
bool operator()(const DSSType &dss) const
void init(double threshold)
long int position(const DSSType &dss, const Point &p) const
bool admissibility(const DSSType &dss, const Point &p) const
DSSLengthLessEqualFilter()
IteratorCirculatorTraits< typenameDSSType::ConstIterator >::Value Point
bool operator()(const DSSType &) const
Always returns false.
long int position(const DSSType &, const Point &) const
When called always throws an exception.
IteratorCirculatorTraits< typenameDSSType::ConstIterator >::Value Point
bool admissibility(const DSSType &, const Point &) const
Always returns false.
Aim: Implements basic operations that will be used in Point and Vector classes.
double norm(const NormType type=L_2) const
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< LambdaFunction, double, double >))
Value operator()(const TDSS &aDSS, const int &indexOfPointInDSS, const int &dssLen) const
PointVector< 2, double > RealVector
LambdaFunction lambdaFunctor
Value operator()(const TDSS &aDSS, const unsigned int indexOfPointInDSS, const unsigned int dssLen) const
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< LambdaFunction, double, double >))
LambdaFunction lambdaFunctor
PointVector< 3, double > RealVector
DGtal is the top-level namespace which contains all DGtal functions and types.
Value & operator+=(const Value &ch)
Value & operator+=(const Value &ch)
double operator()(double x) const
double operator()(double x) const
double operator()(double x) const
DGtal::MelkmanConvexHull< Point, Functor > ch