DGtal  1.3.beta
VCMGeometricFunctors.h
1 
17 #pragma once
18 
31 #if defined(VCMGeometricFunctors_RECURSES)
32 #error Recursive header files inclusion detected in VCMGeometricFunctors.h
33 #else // defined(VCMGeometricFunctors_RECURSES)
34 
35 #define VCMGeometricFunctors_RECURSES
36 
37 #if !defined VCMGeometricFunctors_h
38 
39 #define VCMGeometricFunctors_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
46 
47 // @since 0.8 In DGtal::functors
48 namespace DGtal {
49  namespace functors {
50 
58  template <typename TVCMOnDigitalSurface>
60  typedef TVCMOnDigitalSurface VCMOnDigitalSurface;
63  typedef typename VCMOnDigitalSurface::VectorN RealVector;
64  typedef typename RealVector::Component Scalar;
65  typedef Surfel Argument;
67 
76  : myVCMOnDigitalSurface( aVCMOnDigitalSurface ) {}
77 
85  void attach( ConstAlias<VCMOnDigitalSurface> aVCMOnDigitalSurface )
86  {
87  myVCMOnDigitalSurface = aVCMOnDigitalSurface;
88  }
89 
97  Quantity operator()( const Surfel & s ) const
98  {
99  typedef typename VCMOnDigitalSurface::Surfel2Normals Surfel2Normals;
100  ASSERT( myVCMOnDigitalSurface != 0 );
101  typename Surfel2Normals::const_iterator itSN = myVCMOnDigitalSurface->mapSurfel2Normals().find( s );
102  ASSERT( itSN != myVCMOnDigitalSurface->mapSurfel2Normals().end() );
103  return - itSN->second.vcmNormal;
104  }
105 
106  private:
109  };
110 
111 
119  template <typename TVCMOnDigitalSurface>
121  typedef TVCMOnDigitalSurface VCMOnDigitalSurface;
124  typedef typename VCMOnDigitalSurface::VectorN RealVector;
125  typedef typename RealVector::Component Scalar;
126  typedef Surfel Argument;
127  typedef Scalar Quantity;
128 
137  : myVCMOnDigitalSurface( aVCMOnDigitalSurface )
138  {
139  BOOST_STATIC_ASSERT(( KSpace::dimension == 2 ));
140  }
141 
149  void attach( ConstAlias<VCMOnDigitalSurface> aVCMOnDigitalSurface )
150  {
151  myVCMOnDigitalSurface = aVCMOnDigitalSurface;
152  }
153 
161  Quantity operator()( const Surfel & s ) const
162  {
163  ASSERT( myVCMOnDigitalSurface != 0 );
164  RealVector lambda;
165  bool ok = myVCMOnDigitalSurface->getChiVCMEigenvalues( lambda, s );
166  ASSERT( ok ); boost::ignore_unused_variable_warning( ok );
167 
168  // The last eigenvalue l1 is approximately the mixed "area" 8pi R^3 r / 3
169  // The curvature is related to the first eigenvalue l0.
170  // k1^2 = 3*l0 / (l1*r^2)
171  return sqrt( 3.0 * lambda[0] / lambda[1] ) / myVCMOnDigitalSurface->r();
172  }
173 
174  private:
177  };
178 
188  template <typename TVCMOnDigitalSurface>
190  typedef TVCMOnDigitalSurface VCMOnDigitalSurface;
193  typedef typename VCMOnDigitalSurface::VectorN RealVector;
194  typedef typename RealVector::Component Scalar;
195  typedef Surfel Argument;
196  typedef Scalar Quantity;
197 
206  : myVCMOnDigitalSurface( aVCMOnDigitalSurface )
207  {
208  BOOST_STATIC_ASSERT(( KSpace::dimension == 3 ));
209  }
210 
218  void attach( ConstAlias<VCMOnDigitalSurface> aVCMOnDigitalSurface )
219  {
220  myVCMOnDigitalSurface = aVCMOnDigitalSurface;
221  }
222 
230  Quantity operator()( const Surfel & s ) const
231  {
232  ASSERT( myVCMOnDigitalSurface != 0 );
233  RealVector lambda;
234  bool ok = myVCMOnDigitalSurface->getChiVCMEigenvalues( lambda, s );
235  ASSERT( ok ); boost::ignore_unused_variable_warning( ok );
236 
237  // The last eigenvalue l2 is approximately the mixed "area" 2pi R^3 r^2 / 3
238  // The greatest principal curvature is related to the second eigenvalue l1.
239  // k1^2 = 4*l1 / (l2*r^2)
240  return 2.0 * sqrt( lambda[1] / lambda[2] ) / myVCMOnDigitalSurface->r();
241  }
242 
243  private:
246  };
247 
257  template <typename TVCMOnDigitalSurface>
259  typedef TVCMOnDigitalSurface VCMOnDigitalSurface;
262  typedef typename VCMOnDigitalSurface::VectorN RealVector;
263  typedef typename RealVector::Component Scalar;
264  typedef Surfel Argument;
265  typedef Scalar Quantity;
266 
275  : myVCMOnDigitalSurface( aVCMOnDigitalSurface )
276  {
277  BOOST_STATIC_ASSERT(( KSpace::dimension == 3 ));
278  }
279 
287  void attach( ConstAlias<VCMOnDigitalSurface> aVCMOnDigitalSurface )
288  {
289  myVCMOnDigitalSurface = aVCMOnDigitalSurface;
290  }
291 
299  Quantity operator()( const Surfel & s ) const
300  {
301  ASSERT( myVCMOnDigitalSurface != 0 );
302  RealVector lambda;
303  bool ok = myVCMOnDigitalSurface->getChiVCMEigenvalues( lambda, s );
304  ASSERT( ok ); boost::ignore_unused_variable_warning( ok );
305 
306  // The last eigenvalue l2 is approximately the mixed "area" 2pi R^3 r^2 / 3
307  // The smallest principal curvature is related to the first eigenvalue l0.
308  // k2^2 = 4*l0 / (l2*r^2)
309  return 2.0 * sqrt( lambda[0] / lambda[2] ) / myVCMOnDigitalSurface->r();
310  }
311 
312  private:
315  };
316 
317 
325  template <typename TVCMOnDigitalSurface>
327  typedef TVCMOnDigitalSurface VCMOnDigitalSurface;
330  typedef typename VCMOnDigitalSurface::VectorN RealVector;
331  typedef typename RealVector::Component Scalar;
332  typedef Surfel Argument;
333  typedef Scalar Quantity;
334 
343  : myVCMOnDigitalSurface( aVCMOnDigitalSurface )
344  {
345  BOOST_STATIC_ASSERT(( KSpace::dimension == 3 ));
346  }
347 
355  void attach( ConstAlias<VCMOnDigitalSurface> aVCMOnDigitalSurface )
356  {
357  myVCMOnDigitalSurface = aVCMOnDigitalSurface;
358  }
359 
367  Quantity operator()( const Surfel & s ) const
368  {
369  ASSERT( myVCMOnDigitalSurface != 0 );
370  RealVector lambda;
371  bool ok = myVCMOnDigitalSurface->getChiVCMEigenvalues( lambda, s );
372  ASSERT( ok ); boost::ignore_unused_variable_warning( ok );
373 
374  // The last eigenvalue l2 is approximately the mixed "area" 2pi R^3 r^2 / 3
375  // The greatest principal curvature is related to the second eigenvalue l1.
376  // k1^2 = 4*l1 / (l2*r^2)
377  Quantity k1 = 2.0 * sqrt( lambda[1] / lambda[2] ) / myVCMOnDigitalSurface->r();
378 
379  // The last eigenvalue l2 is approximately the mixed "area" 2pi R^3 r^2 / 3
380  // The smallest principal curvature is related to the first eigenvalue l0.
381  // k2^2 = 4*l0 / (l2*r^2)
382  Quantity k2 = 2.0 * sqrt( lambda[0] / lambda[2] ) / myVCMOnDigitalSurface->r();
383  return (k1+k2) * 0.5;
384  }
385 
386  private:
389  };
390 
391  } //namespace functors
392 } // namespace DGtal
393 
394 
396 // Includes inline functions.
397 
398 // //
400 
401 #endif // !defined VCMGeometricFunctors_h
402 
403 #undef VCMGeometricFunctors_RECURSES
404 #endif // else defined(VCMGeometricFunctors_RECURSES)
DGtal::functors::VCMAbsoluteCurvatureFunctor::Quantity
Scalar Quantity
Definition: VCMGeometricFunctors.h:127
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::VCMSecondPrincipalAbsoluteCurvatureFunctor
VCMSecondPrincipalAbsoluteCurvatureFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
Definition: VCMGeometricFunctors.h:274
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::myVCMOnDigitalSurface
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
Definition: VCMGeometricFunctors.h:388
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DGtal::functors::VCMNormalVectorFunctor::VCMOnDigitalSurface
TVCMOnDigitalSurface VCMOnDigitalSurface
Definition: VCMGeometricFunctors.h:60
DGtal::functors::VCMNormalVectorFunctor::operator()
Quantity operator()(const Surfel &s) const
Definition: VCMGeometricFunctors.h:97
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::attach
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
Definition: VCMGeometricFunctors.h:355
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::Scalar
RealVector::Component Scalar
Definition: VCMGeometricFunctors.h:194
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::operator()
Quantity operator()(const Surfel &s) const
Definition: VCMGeometricFunctors.h:299
DGtal::functors::VCMAbsoluteCurvatureFunctor::Scalar
RealVector::Component Scalar
Definition: VCMGeometricFunctors.h:125
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::Argument
Surfel Argument
Definition: VCMGeometricFunctors.h:264
DGtal::functors::VCMAbsoluteCurvatureFunctor::RealVector
VCMOnDigitalSurface::VectorN RealVector
Definition: VCMGeometricFunctors.h:124
DGtal::functors::VCMAbsoluteCurvatureFunctor::Argument
Surfel Argument
Definition: VCMGeometricFunctors.h:126
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::KSpace
VCMOnDigitalSurface::KSpace KSpace
Definition: VCMGeometricFunctors.h:260
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor
Aim: A functor Surfel -> Quantity that returns the first principal absolute curvature (greatest curva...
Definition: VCMGeometricFunctors.h:189
DGtal::functors::VCMAbsoluteCurvatureFunctor::operator()
Quantity operator()(const Surfel &s) const
Definition: VCMGeometricFunctors.h:161
DGtal::functors::VCMNormalVectorFunctor::VCMNormalVectorFunctor
VCMNormalVectorFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
Definition: VCMGeometricFunctors.h:75
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::Surfel
VCMOnDigitalSurface::Surfel Surfel
Definition: VCMGeometricFunctors.h:261
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::operator()
Quantity operator()(const Surfel &s) const
Definition: VCMGeometricFunctors.h:230
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::myVCMOnDigitalSurface
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
Definition: VCMGeometricFunctors.h:245
DGtal::functors::VCMAbsoluteCurvatureFunctor
Aim: A functor Surfel -> Quantity that returns the absolute curvature at given surfel....
Definition: VCMGeometricFunctors.h:120
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::myVCMOnDigitalSurface
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
Definition: VCMGeometricFunctors.h:314
DGtal::functors::VCMNormalVectorFunctor::Argument
Surfel Argument
Definition: VCMGeometricFunctors.h:65
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::Scalar
RealVector::Component Scalar
Definition: VCMGeometricFunctors.h:263
DGtal::functors::VCMAbsoluteCurvatureFunctor::KSpace
VCMOnDigitalSurface::KSpace KSpace
Definition: VCMGeometricFunctors.h:122
DGtal::PointVector::Component
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:614
DGtal::functors::VCMNormalVectorFunctor::Scalar
RealVector::Component Scalar
Definition: VCMGeometricFunctors.h:64
DGtal::functors::VCMNormalVectorFunctor::Quantity
RealVector Quantity
Definition: VCMGeometricFunctors.h:66
KSpace
Z3i::KSpace KSpace
Definition: testArithmeticalDSSComputerOnSurfels.cpp:48
DGtal::functors::VCMAbsoluteCurvatureFunctor::Surfel
VCMOnDigitalSurface::Surfel Surfel
Definition: VCMGeometricFunctors.h:123
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::operator()
Quantity operator()(const Surfel &s) const
Definition: VCMGeometricFunctors.h:367
DGtal::KhalimskySpaceND::dimension
static const constexpr Dimension dimension
Definition: KhalimskySpaceND.h:430
Surfel
KSpace::SCell Surfel
Definition: testArithmeticalDSSComputerOnSurfels.cpp:50
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::attach
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
Definition: VCMGeometricFunctors.h:218
DGtal::functors::VCMNormalVectorFunctor::myVCMOnDigitalSurface
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
Definition: VCMGeometricFunctors.h:108
DGtal::CountedConstPtrOrConstPtr< VCMOnDigitalSurface >
DGtal::functors::VCMNormalVectorFunctor::attach
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
Definition: VCMGeometricFunctors.h:85
DGtal::functors::VCMAbsoluteCurvatureFunctor::myVCMOnDigitalSurface
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
Definition: VCMGeometricFunctors.h:176
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::KSpace
VCMOnDigitalSurface::KSpace KSpace
Definition: VCMGeometricFunctors.h:328
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::Scalar
RealVector::Component Scalar
Definition: VCMGeometricFunctors.h:331
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::VCMOnDigitalSurface
TVCMOnDigitalSurface VCMOnDigitalSurface
Definition: VCMGeometricFunctors.h:259
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::RealVector
VCMOnDigitalSurface::VectorN RealVector
Definition: VCMGeometricFunctors.h:330
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::VCMOnDigitalSurface
TVCMOnDigitalSurface VCMOnDigitalSurface
Definition: VCMGeometricFunctors.h:327
DGtal::functors::VCMAbsoluteCurvatureFunctor::attach
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
Definition: VCMGeometricFunctors.h:149
DGtal::functors::VCMNormalVectorFunctor
Aim: A functor Surfel -> Quantity that returns the outer normal vector at given surfel.
Definition: VCMGeometricFunctors.h:59
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::Argument
Surfel Argument
Definition: VCMGeometricFunctors.h:332
DGtal::functors::VCMNormalVectorFunctor::Surfel
VCMOnDigitalSurface::Surfel Surfel
Definition: VCMGeometricFunctors.h:62
DGtal::functors::VCMAbsoluteCurvatureFunctor::VCMAbsoluteCurvatureFunctor
VCMAbsoluteCurvatureFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
Definition: VCMGeometricFunctors.h:136
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::attach
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
Definition: VCMGeometricFunctors.h:287
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::VCMOnDigitalSurface
TVCMOnDigitalSurface VCMOnDigitalSurface
Definition: VCMGeometricFunctors.h:190
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::KSpace
VCMOnDigitalSurface::KSpace KSpace
Definition: VCMGeometricFunctors.h:191
DGtal::functors::VCMAbsoluteCurvatureFunctor::VCMOnDigitalSurface
TVCMOnDigitalSurface VCMOnDigitalSurface
Definition: VCMGeometricFunctors.h:121
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor
Aim: A functor Surfel -> Quantity that returns the second principal absolute curvature (smallest curv...
Definition: VCMGeometricFunctors.h:258
DGtal::functors::VCMNormalVectorFunctor::RealVector
VCMOnDigitalSurface::VectorN RealVector
Definition: VCMGeometricFunctors.h:63
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::RealVector
VCMOnDigitalSurface::VectorN RealVector
Definition: VCMGeometricFunctors.h:262
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::Quantity
Scalar Quantity
Definition: VCMGeometricFunctors.h:196
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::VCMMeanAbsoluteCurvatures3DFunctor
VCMMeanAbsoluteCurvatures3DFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
Definition: VCMGeometricFunctors.h:342
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::Surfel
VCMOnDigitalSurface::Surfel Surfel
Definition: VCMGeometricFunctors.h:192
DGtal::functors::VCMNormalVectorFunctor::KSpace
VCMOnDigitalSurface::KSpace KSpace
Definition: VCMGeometricFunctors.h:61
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::Surfel
VCMOnDigitalSurface::Surfel Surfel
Definition: VCMGeometricFunctors.h:329
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor::Quantity
Scalar Quantity
Definition: VCMGeometricFunctors.h:333
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::RealVector
VCMOnDigitalSurface::VectorN RealVector
Definition: VCMGeometricFunctors.h:193
DGtal::functors::VCMMeanAbsoluteCurvatures3DFunctor
Aim: A functor Surfel -> Quantity that returns the mean of absolute curvatures at given surfel: (abs(...
Definition: VCMGeometricFunctors.h:326
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::Argument
Surfel Argument
Definition: VCMGeometricFunctors.h:195
DGtal::functors::VCMFirstPrincipalAbsoluteCurvatureFunctor::VCMFirstPrincipalAbsoluteCurvatureFunctor
VCMFirstPrincipalAbsoluteCurvatureFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
Definition: VCMGeometricFunctors.h:205
DGtal::functors::VCMSecondPrincipalAbsoluteCurvatureFunctor::Quantity
Scalar Quantity
Definition: VCMGeometricFunctors.h:265