DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes
DGtal::ParametricShapeArcLengthFunctor< TParametricShape > Class Template Reference

#include <DGtal/geometry/curves/estimation/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.

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

Constructor.

Parameters
aShapethe input shape.

Definition at line 93 of file ParametricShapeArcLengthFunctor.h.

93 : myShape(aShape) {};
ParametricShape * myShape
Copy of the implicit shape.
template<typename TParametricShape >
DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::~ParametricShapeArcLengthFunctor ( )
inline

Destructor.

Definition at line 99 of file ParametricShapeArcLengthFunctor.h.

99 {}

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
aFirstPointthe first point
aSecondPointthe second point
Returns
the estimated arc length

Definition at line 125 of file ParametricShapeArcLengthFunctor.h.

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

126  {
127 
128  ASSERT(myShape);
129 
130  //determining nbSamples from the bounding box size of the shape
131  Vector v = myShape->getUpperBound() - myShape->getLowerBound();
132  double n = (double) NumberTraits<Integer>::castToInt64_t( (const DGtal::int32_t)v.norm(Vector::L_infty) );
133  unsigned int nbSamples = (unsigned int) ceil( n*100 );
134 
135  //computes the angles
136  double t = myShape->parameter( aFirstPoint );
137  double t2 = myShape->parameter( aSecondPoint );
138  return myShape->arclength (t,t2,nbSamples);
139 
140  }
ParametricShape * myShape
Copy of the implicit shape.
static DGtal::int64_t castToInt64_t(const Integer &aT)
Definition: NumberTraits.h:146
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
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 DGtal::ParametricShapeArcLengthFunctor< TParametricShape >::myShape.

148  {
149 
150  ASSERT(myShape);
151 
152  //determining nbSamples from the bounding box size of the shape
153  Vector v = myShape->getUpperBound() - myShape->getLowerBound();
154  double n = (double) NumberTraits<Integer>::castToInt64_t( (const DGtal::int32_t)v.norm(Vector::L_infty) );
155  unsigned int nbSamples = (unsigned int) ceil( n*100 );
156 
157  return myShape->arclength (0,2*M_PI,nbSamples);
158  }
ParametricShape * myShape
Copy of the implicit shape.
static DGtal::int64_t castToInt64_t(const Integer &aT)
Definition: NumberTraits.h:146
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
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.

112  {
113  myShape = other.myShape;
114  return *this;
115  }
ParametricShape * myShape
Copy of the implicit shape.

Field Documentation

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

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