DGtal 1.3.0
Loading...
Searching...
No Matches
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)
35#define VCMGeometricFunctors_RECURSES
36
37#if !defined VCMGeometricFunctors_h
39#define VCMGeometricFunctors_h
40
42// Inclusions
43#include <iostream>
44#include "DGtal/base/Common.h"
46
47// @since 0.8 In DGtal::functors
48namespace DGtal {
49 namespace functors {
50
58 template <typename TVCMOnDigitalSurface>
60 typedef TVCMOnDigitalSurface VCMOnDigitalSurface;
61 typedef typename VCMOnDigitalSurface::KSpace KSpace;
62 typedef typename VCMOnDigitalSurface::Surfel Surfel;
63 typedef typename VCMOnDigitalSurface::VectorN RealVector;
64 typedef typename RealVector::Component Scalar;
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;
122 typedef typename VCMOnDigitalSurface::KSpace KSpace;
123 typedef typename VCMOnDigitalSurface::Surfel Surfel;
124 typedef typename VCMOnDigitalSurface::VectorN RealVector;
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;
191 typedef typename VCMOnDigitalSurface::KSpace KSpace;
192 typedef typename VCMOnDigitalSurface::Surfel Surfel;
193 typedef typename VCMOnDigitalSurface::VectorN RealVector;
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;
260 typedef typename VCMOnDigitalSurface::KSpace KSpace;
261 typedef typename VCMOnDigitalSurface::Surfel Surfel;
262 typedef typename VCMOnDigitalSurface::VectorN RealVector;
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;
328 typedef typename VCMOnDigitalSurface::KSpace KSpace;
329 typedef typename VCMOnDigitalSurface::Surfel Surfel;
330 typedef typename VCMOnDigitalSurface::VectorN RealVector;
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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Smart or simple const pointer on T. It can be a smart pointer based on reference counts or a sim...
static const constexpr Dimension dimension
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:614
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A functor Surfel -> Quantity that returns the absolute curvature at given surfel....
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
VCMAbsoluteCurvatureFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
Aim: A functor Surfel -> Quantity that returns the first principal absolute curvature (greatest curva...
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
VCMFirstPrincipalAbsoluteCurvatureFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
Aim: A functor Surfel -> Quantity that returns the mean of absolute curvatures at given surfel: (abs(...
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
VCMMeanAbsoluteCurvatures3DFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
Aim: A functor Surfel -> Quantity that returns the outer normal vector at given surfel.
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.
Quantity operator()(const Surfel &s) const
VCMNormalVectorFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
VCMOnDigitalSurface::VectorN RealVector
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
Aim: A functor Surfel -> Quantity that returns the second principal absolute curvature (smallest curv...
void attach(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface)
VCMSecondPrincipalAbsoluteCurvatureFunctor(ConstAlias< VCMOnDigitalSurface > aVCMOnDigitalSurface=0)
CountedConstPtrOrConstPtr< VCMOnDigitalSurface > myVCMOnDigitalSurface
The shape of interest.