DGtal  1.0.0
ShapeGeometricFunctors.h
1 
17 #pragma once
18 
31 #if defined(ShapeGeometricFunctors_RECURSES)
32 #error Recursive header files inclusion detected in ShapeGeometricFunctors.h
33 #else // defined(ShapeGeometricFunctors_RECURSES)
34 
35 #define ShapeGeometricFunctors_RECURSES
36 
37 #if !defined ShapeGeometricFunctors_h
38 
39 #define ShapeGeometricFunctors_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
46 
47 namespace DGtal
48 {
49  namespace functors
50  {
51 
52  namespace ShapeGeometricFunctors
53  {
54 
63  template <typename TShape>
65  typedef TShape Shape;
66  typedef typename Shape::RealPoint RealPoint;
69  typedef Quantity Value;
70 
77  ShapePositionFunctor( ConstAlias<Shape> aShape = 0 ) : myShape( aShape ) {}
78 
85  void attach( ConstAlias<Shape> aShape )
86  {
87  myShape = aShape;
88  }
89 
95  Quantity operator()( const RealPoint & p ) const
96  {
97  return p;
98  }
99 
100  private:
103  };
104 
113  template <typename TShape>
115  typedef TShape Shape;
116  typedef typename Shape::RealPoint RealPoint;
117  typedef typename Shape::RealVector RealVector;
119  typedef typename RealVector::Component Scalar;
121  typedef Quantity Value;
122 
130 
137  void attach( ConstAlias<Shape> aShape )
138  {
139  myShape = aShape;
140  }
141 
147  Quantity operator()( const RealPoint & p ) const
148  {
149  RealVector v = myShape->gradient( p );
150  Scalar norm = v.norm();
151  return ( norm != 0 ) ? v / norm : v;
152  }
153 
154  private:
157  };
158 
159 
168  template <typename TShape>
170  typedef TShape Shape;
171  typedef typename Shape::RealPoint RealPoint;
172  typedef typename Shape::RealVector RealVector;
173  typedef typename RealVector::Component Scalar;
175  typedef Scalar Quantity;
176  typedef Quantity Value;
177 
185 
192  void attach( ConstAlias<Shape> aShape )
193  {
194  myShape = aShape;
195  }
196 
202  Quantity operator()( const RealPoint & p ) const
203  {
204  return myShape->meanCurvature( p );
205  }
206 
207  private:
210  };
211 
220  template <typename TShape>
222  typedef TShape Shape;
223  typedef typename Shape::RealPoint RealPoint;
224  typedef typename Shape::RealVector RealVector;
225  typedef typename RealVector::Component Scalar;
227  typedef Scalar Quantity;
228  typedef Quantity Value;
229 
237 
244  void attach( ConstAlias<Shape> aShape )
245  {
246  myShape = aShape;
247  }
248 
254  Quantity operator()( const RealPoint & p ) const
255  {
256  return myShape->gaussianCurvature( p );
257  }
258 
259  private:
262  };
263 
264  } // namespace ShapeGeometricFunctors
265  } // namespace functors
266 } // namespace DGtal
267 
268 
270 // Includes inline functions.
271 #include "DGtal/shapes/ShapeGeometricFunctors.ih"
272 
273 // //
275 
276 #endif // !defined ShapeGeometricFunctors_h
277 
278 #undef ShapeGeometricFunctors_RECURSES
279 #endif // else defined(ShapeGeometricFunctors_RECURSES)
Aim: A functor RealPoint -> Quantity that returns the position of the point itself.
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
Z3i::RealVector RealVector
PointVector< 3, double > RealPoint
CountedConstPtrOrConstPtr< Shape > myShape
The shape of interest.
Aim: A functor RealPoint -> Quantity that returns the mean curvature at given point.
CountedConstPtrOrConstPtr< Shape > myShape
The shape of interest.
CountedConstPtrOrConstPtr< Shape > myShape
The shape of interest.
CountedConstPtrOrConstPtr< Shape > myShape
The shape of interest.
Aim: A functor RealPoint -> Quantity that returns the normal vector at given point.
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A functor RealPoint -> Quantity that returns the gaussian curvature at given point.
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:614