DGtal 1.3.0
Loading...
Searching...
No Matches
ParametricShapeArcLengthFunctor.h
1
17#pragma once
18
34#if defined(ParametricShapeArcLengthFunctor_RECURSES)
35#error Recursive header files inclusion detected in ParametricShapeArcLengthFunctor.h
36#else // defined(ParametricShapeArcLengthFunctor_RECURSES)
38#define ParametricShapeArcLengthFunctor_RECURSES
39
40#if !defined ParametricShapeArcLengthFunctor_h
42#define ParametricShapeArcLengthFunctor_h
43
45// Inclusions
46#include <iostream>
47#include "DGtal/base/Common.h"
49
50namespace DGtal
51{
52
54 // template class ParametricShapeArcLengthFunctor
63 template <typename TParametricShape>
65 {
66
67 // ----------------------- Standard services ------------------------------
68 public:
69
71 typedef TParametricShape ParametricShape;
72
74 typedef typename TParametricShape::RealPoint RealPoint;
75
77 typedef double Quantity;
78
83
84
90
91
96
97
98 // ----------------------- Interface --------------------------------------
99 public:
107
115 Quantity operator()(const RealPoint &aFirstPoint,const RealPoint &aSecondPoint) const
116 {
117 //determining nbSamples from the bounding box size of the shape
118 RealPoint v = myShape.getUpperBound() - myShape.getLowerBound();
119 double n = v.norm(RealPoint::L_infty);
120 unsigned int nbSamples = (unsigned int) ceil( n*100 );
121
122 //computes the angles
123 double t = myShape.parameter( aFirstPoint );
124 double t2 = myShape.parameter( aSecondPoint );
125 return myShape.arclength( t, t2, nbSamples );
126
127 }
128
135 {
136 //determining nbSamples from the bounding box size of the shape
137 RealPoint v = myShape.getUpperBound() - myShape.getLowerBound();
138 double n = v.norm(RealPoint::L_infty);
139 unsigned int nbSamples = (unsigned int) ceil( n*100 );
140
141 return myShape.arclength( 0,2*M_PI, nbSamples );
142 }
143
144 // ------------------------- Private Datas --------------------------------
145 private:
146
149
150 // ------------------------- Internals ------------------------------------
151 private:
152
153 }; // end of class ParametricShapeArcLengthFunctor
154
155} // namespace DGtal
156
157 //
159
160#endif // !defined ParametricShapeArcLengthFunctor_h
161
162#undef ParametricShapeArcLengthFunctor_RECURSES
163#endif // else defined(ParametricShapeArcLengthFunctor_RECURSES)
Aim: implements a functor that estimates the arc length of a paramtric curve.
TParametricShape ParametricShape
Type of parametric shape.
ParametricShapeArcLengthFunctor & operator=(const ParametricShapeArcLengthFunctor &other)=delete
const ParametricShape & myShape
Reference of the implicit shape.
Quantity operator()(const RealPoint &aFirstPoint, const RealPoint &aSecondPoint) const
TParametricShape::RealPoint RealPoint
Type of const iterator on points.
ParametricShapeArcLengthFunctor(const ParametricShape &aShape)
DGtal is the top-level namespace which contains all DGtal functions and types.