DGtal  1.5.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)
38 #define ElementaryConvolutionNormalVectorEstimator_RECURSES
39 
40 #if !defined ElementaryConvolutionNormalVectorEstimator_h
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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Estimates normal vector by convolution of elementary normal vector to adjacent surfel.
ElementaryConvolutionNormalVectorEstimator(ConstAlias< SCellEmbedder > anEmbedder, const double h)
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition: Common.h:136
PointVector< 3, double > RealPoint