DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions
DGtal::detail::DistanceFromDCA Struct Reference

#include <SegmentComputerEstimators.h>

Public Types

typedef std::pair< double, double > Value

Public Member Functions

template<typename DCA >
Value operator() (const typename DCA::ConstIterator &it, const DCA &aDCA, const double &aH) const

Detailed Description

Description of class 'DistanceFromDCA'

Aim: estimates the distance of a given pair of points to the separating circle of a DCA.

Definition at line 933 of file SegmentComputerEstimators.h.


Member Typedef Documentation

typedef std::pair<double,double> DGtal::detail::DistanceFromDCA::Value

Definition at line 936 of file SegmentComputerEstimators.h.


Member Function Documentation

template<typename DCA >
Value DGtal::detail::DistanceFromDCA::operator() ( const typename DCA::ConstIterator &  it,
const DCA &  aDCA,
const double &  aH 
) const
inline

Operator()

Returns:
distances (in a pair) of the inner and outer points pointed by it to the separating circle of aDCA
Parameters:
itposition where the estimation has to be done
aDCAan instance of segment computer devoted to the DCA recognition.
aHgrid step
Template Parameters:
DCAa model of segment computer devoted to the DCA recognition, basically geometricDCA.

Definition at line 955 of file SegmentComputerEstimators.h.

{
typedef typename DCA::ConstIterator ConstIterator;
typedef typename DCA::Pair Pair;
typedef typename DCA::Point Point;
typedef typename Point::Coordinate Coordinate;
if ( !aDCA.isStraight() )
{
//separating circle center
double c0, c1, r;
aDCA.getSeparatingCircle().getParameters(c0, c1, r);
//points
Pair pair = *it;
Point i = pair.first;
Point o = pair.second;
//distances
double distI0 = NumberTraits<Coordinate>::castToDouble(i[0]) - c0;
double distI1 = NumberTraits<Coordinate>::castToDouble(i[1]) - c1;
double distI = std::sqrt( distI0*distI0 + distI1*distI1 ) - r;
double distO0 = NumberTraits<Coordinate>::castToDouble(o[0]) - c0;
double distO1 = NumberTraits<Coordinate>::castToDouble(o[1]) - c1;
double distO = std::sqrt( distO0*distO0 + distO1*distO1 ) - r;
return Value( distI*aH, distO*aH );
}
else
{
//separating straight line
double a, b, c;
aDCA.getGeometricalDSSPtr()->getParameters(a, b, c);
//norm
double n = std::sqrt(a*a + b*b);
//points
Pair pair = *it;
Point i = pair.first;
Point o = pair.second;
//distances
double distI = rI / n;
double distO = rO / n;
return Value( distI*aH, distO*aH );
}
}

The documentation for this struct was generated from the following file: