DGtal  0.9.2
ParametricShapeCurvatureFunctor.h
1 
17 #pragma once
18 
33 #if defined(ParametricShapeCurvatureFunctor_RECURSES)
34 #error Recursive header files inclusion detected in ParametricShapeCurvatureFunctor.h
35 #else // defined(ParametricShapeCurvatureFunctor_RECURSES)
36 
37 #define ParametricShapeCurvatureFunctor_RECURSES
38 
39 #if !defined ParametricShapeCurvatureFunctor_h
40 
41 #define ParametricShapeCurvatureFunctor_h
42 
44 // Inclusions
45 #include <iostream>
46 #include "DGtal/base/Common.h"
48 
49 namespace DGtal
50 {
51 
53  // template class ParametricShapeCurvatureFunctor
64  template <typename TParametricShape>
66  {
67 
68  // ----------------------- Standard services ------------------------------
69  public:
70 
72  typedef TParametricShape ParametricShape;
73 
75  typedef typename TParametricShape::RealPoint RealPoint;
76 
78  typedef double Quantity;
79 
85 
86 
92  ParametricShapeCurvatureFunctor(ParametricShape *aShape): myShape(aShape) {};
93 
94 
99 
100 
101  // ----------------------- Interface --------------------------------------
102  public:
103 
111  {
112  myShape = other.myShape;
113  return *this;
114  }
115 
116 
123  Quantity operator()(const RealPoint &aPoint)
124  {
125  ASSERT(myShape);
126 
127  double t = myShape->parameter( aPoint );
128  return myShape->curvature( t );
129  }
130 
131 
132  // ------------------------- Private Datas --------------------------------
133  private:
134 
136  ParametricShape *myShape;
137 
138  // ------------------------- Internals ------------------------------------
139  private:
140 
141  }; // end of class ParametricShapeCurvatureFunctor
142 
143 } // namespace DGtal
144 
145  //
147 
148 #endif // !defined ParametricShapeCurvatureFunctor_h
149 
150 #undef ParametricShapeCurvatureFunctor_RECURSES
151 #endif // else defined(ParametricShapeCurvatureFunctor_RECURSES)
ParametricShape * myShape
Copy of the implicit shape.
TParametricShape ParametricShape
Type of parametric shape.
ParametricShapeCurvatureFunctor & operator=(const ParametricShapeCurvatureFunctor &other)
DGtal is the top-level namespace which contains all DGtal functions and types.
TParametricShape::RealPoint RealPoint
Type of points.
Aim: implements a functor that computes the curvature at a given point of a parametric shape...