DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Attributes
DGtal::ParametricShapeArcLengthFunctor< TParametricShape > Class Template Reference

#include <ParametricShapeArcLengthFunctor.h>

Public Types

typedef TParametricShape ParametricShape
typedef TParametricShape::RealPoint RealPoint
typedef TParametricShape::Point Point
typedef TParametricShape::Point Vector
typedef Point::Coordinate Integer
typedef double Quantity

Public Member Functions

 ParametricShapeArcLengthFunctor ()
 ParametricShapeArcLengthFunctor (ParametricShape *aShape)
 ~ParametricShapeArcLengthFunctor ()
ParametricShapeArcLengthFunctoroperator= (const ParametricShapeArcLengthFunctor &other)
Quantity operator() (const RealPoint &aFirstPoint, const RealPoint &aSecondPoint)
Quantity operator() ()

Private Attributes

ParametricShapemyShape

Detailed Description

template<typename TParametricShape>
class DGtal::ParametricShapeArcLengthFunctor< TParametricShape >

Aim: implements a functor that estimates the arc length of a paramtric curve.

Description of template class 'ParametricShapeArcLengthFunctor'

Template Parameters:
TParametricShapea model of parametric shape.

Definition at line 64 of file ParametricShapeArcLengthFunctor.h.


Member Typedef Documentation

template<typename TParametricShape >
typedef Point::Coordinate DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::Integer

Definition at line 77 of file ParametricShapeArcLengthFunctor.h.

template<typename TParametricShape >
typedef TParametricShape DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::ParametricShape

Type of parametric shape.

Definition at line 71 of file ParametricShapeArcLengthFunctor.h.

template<typename TParametricShape >
typedef TParametricShape::Point DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::Point

Definition at line 75 of file ParametricShapeArcLengthFunctor.h.

template<typename TParametricShape >
typedef double DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::Quantity

Type of the functor output.

Definition at line 80 of file ParametricShapeArcLengthFunctor.h.

template<typename TParametricShape >
typedef TParametricShape::RealPoint DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::RealPoint

Type of const iterator on points.

Definition at line 74 of file ParametricShapeArcLengthFunctor.h.

template<typename TParametricShape >
typedef TParametricShape::Point DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::Vector

Definition at line 76 of file ParametricShapeArcLengthFunctor.h.


Constructor & Destructor Documentation

template<typename TParametricShape >
DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::ParametricShapeArcLengthFunctor ( )
inline

Constructor. Forbidden by default (protected to avoid g++ warnings).

Definition at line 86 of file ParametricShapeArcLengthFunctor.h.

{}
template<typename TParametricShape >
DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::ParametricShapeArcLengthFunctor ( ParametricShape aShape)
inline

Constructor.

Parameters:
sShapethe input shape.

Definition at line 93 of file ParametricShapeArcLengthFunctor.h.

: myShape(aShape) {};
template<typename TParametricShape >
DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::~ParametricShapeArcLengthFunctor ( )
inline

Destructor.

Definition at line 99 of file ParametricShapeArcLengthFunctor.h.

{}

Member Function Documentation

template<typename TParametricShape >
Quantity DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::operator() ( const RealPoint aFirstPoint,
const RealPoint aSecondPoint 
)
inline

Compute the arc length between two points.

Parameters:
aFirstPoint
aSecondPoint
Returns:
the estimated arc length

Definition at line 125 of file ParametricShapeArcLengthFunctor.h.

References DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::myShape.

{
ASSERT(myShape);
//determining nbSamples from the bounding box size of the shape
Vector v = myShape->getUpperBound() - myShape->getLowerBound();
double n = (double) NumberTraits<Integer>::castToInt64_t( (const DGtal::int32_t)v.norm(Vector::L_infty) );
unsigned int nbSamples = (unsigned int) ceil( n*100 );
//computes the angles
double t = myShape->parameter( aFirstPoint );
double t2 = myShape->parameter( aSecondPoint );
return myShape->arclength (t,t2,nbSamples);
}
template<typename TParametricShape >
Quantity DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::operator() ( )
inline

Compute the total length

Returns:
the estimated length

Definition at line 147 of file ParametricShapeArcLengthFunctor.h.

References M_PI, and DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::myShape.

{
ASSERT(myShape);
//determining nbSamples from the bounding box size of the shape
Vector v = myShape->getUpperBound() - myShape->getLowerBound();
double n = (double) NumberTraits<Integer>::castToInt64_t( (const DGtal::int32_t)v.norm(Vector::L_infty) );
unsigned int nbSamples = (unsigned int) ceil( n*100 );
return myShape->arclength (0,2*M_PI,nbSamples);
}
template<typename TParametricShape >
ParametricShapeArcLengthFunctor& DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::operator= ( const ParametricShapeArcLengthFunctor< TParametricShape > &  other)
inline

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.

Definition at line 111 of file ParametricShapeArcLengthFunctor.h.

References DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::myShape.

{
myShape = other.myShape;
return *this;
}

Field Documentation

template<typename TParametricShape >
ParametricShape* DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::myShape
private

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