OMToolkit  1.0
The polygonal mesh processing tool.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OMGaussFunc.h
Go to the documentation of this file.
1 //==============================================================================
14 #ifndef _OM_GAUSS_FUNC_H_
15 #define _OM_GAUSS_FUNC_H_
16 
17 #include <stdlib.h>
18 
19 namespace OMToolkit
20 {
24  template <typename Scalar>
26  {
27  public:
33  OMGaussFunction(Scalar mu, Scalar sigma)
34  {
35  m_mu = mu;
36  m_front = 1/(sigma * sqrt(2 * M_PI));
37  m_denomExp = 2 * sigma * sigma;
38  }
39 
45  Scalar getValNorm(Scalar x)
46  {
47  Scalar aux = (x - m_mu);
48  aux *= aux;
49  return m_front * exp( (-aux) / m_denomExp);
50  }
51 
57  Scalar getVal(Scalar x)
58  {
59  Scalar aux = (x - m_mu);
60  aux *= aux;
61  return exp( (-aux) / m_denomExp);
62  }
63 
64  private:
65 
69  Scalar m_mu;
70 
71  /*
72  * Helper variable in gauss function computation
73  */
74  Scalar m_front;
75 
76  /*
77  * Helper variable in gauss function computation
78  */
79  Scalar m_denomExp;
80  }; // class
81 }
82 
83 #endif