DGtal  1.3.beta
ElementaryConvolutionNormalVectorEstimator.h
1 
17 #pragma once
18 
34 #if defined(ElementaryConvolutionNormalVectorEstimator_RECURSES)
35 #error Recursive header files inclusion detected in ElementaryConvolutionNormalVectorEstimator.h
36 #else // defined(ElementaryConvolutionNormalVectorEstimator_RECURSES)
37 
38 #define ElementaryConvolutionNormalVectorEstimator_RECURSES
39 
40 #if !defined ElementaryConvolutionNormalVectorEstimator_h
41 
42 #define ElementaryConvolutionNormalVectorEstimator_h
43 
45 // Inclusions
46 #include <iostream>
47 #include <DGtal/base/Common.h>
48 #include <DGtal/topology/SCellsFunctors.h>
49 #include <vector>
50 
52 
53 namespace DGtal
54 {
55  namespace functors
56  {
58  // template class ElementaryConvolutionNormalVectorEstimator
74  template <typename TSurfel, typename TEmbedder>
76  {
77  public:
78 
79  typedef TSurfel Surfel;
80  typedef TEmbedder SCellEmbedder;
83 
91  const double h):
92  myEmbedder(&anEmbedder), myH(h)
93  {
94  }
95 
102  void pushSurfel(const Surfel & aSurf,
103  const double aDistance)
104  {
105  RealPoint elementary;
106  Dimension i = myEmbedder->space().sOrthDir ( aSurf );
107  elementary[ i ] = myEmbedder->space().sDirect ( aSurf, i ) ? 1 : -1;
108 
109  myWeightedVector += aDistance *elementary;
110  }
111 
118  {
119  return myWeightedVector.getNormalized();
120  }
121 
126  void reset()
127  {
128  myWeightedVector = RealPoint().diagonal(0.0);
129  }
130 
131 
132  private:
133 
136 
139 
140  //Grid step
141  double myH;
142 
143  }; // end of class ElementaryConvolutionNormalVectorEstimator
144  } //namespace functors
145 } // namespace DGtal
146 
147 
148 // //
150 
151 #endif // !defined ElementaryConvolutionNormalVectorEstimator_h
152 
153 #undef ElementaryConvolutionNormalVectorEstimator_RECURSES
154 #endif // else defined(ElementaryConvolutionNormalVectorEstimator_RECURSES)
DGtal::functors::ElementaryConvolutionNormalVectorEstimator
Aim: Estimates normal vector by convolution of elementary normal vector to adjacent surfel.
Definition: ElementaryConvolutionNormalVectorEstimator.h:75
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::RealPoint
SCellEmbedder::RealPoint RealPoint
Definition: ElementaryConvolutionNormalVectorEstimator.h:81
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::ElementaryConvolutionNormalVectorEstimator::myH
double myH
Definition: ElementaryConvolutionNormalVectorEstimator.h:141
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::pushSurfel
void pushSurfel(const Surfel &aSurf, const double aDistance)
Definition: ElementaryConvolutionNormalVectorEstimator.h:102
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::Quantity
RealPoint Quantity
Definition: ElementaryConvolutionNormalVectorEstimator.h:82
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::myWeightedVector
RealPoint myWeightedVector
Array of CGAL points.
Definition: ElementaryConvolutionNormalVectorEstimator.h:138
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::Surfel
TSurfel Surfel
Definition: ElementaryConvolutionNormalVectorEstimator.h:79
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::reset
void reset()
Definition: ElementaryConvolutionNormalVectorEstimator.h:126
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::ElementaryConvolutionNormalVectorEstimator
ElementaryConvolutionNormalVectorEstimator(ConstAlias< SCellEmbedder > anEmbedder, const double h)
Definition: ElementaryConvolutionNormalVectorEstimator.h:90
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::eval
Quantity eval()
Definition: ElementaryConvolutionNormalVectorEstimator.h:117
RealPoint
Z2i::RealPoint RealPoint
Definition: testAstroid2D.cpp:46
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::SCellEmbedder
TEmbedder SCellEmbedder
Definition: ElementaryConvolutionNormalVectorEstimator.h:80
DGtal::functors::ElementaryConvolutionNormalVectorEstimator::myEmbedder
const SCellEmbedder * myEmbedder
Alias of the geometrical embedder.
Definition: ElementaryConvolutionNormalVectorEstimator.h:135