Helios++
Helios software for LiDAR simulations
GaussianFunction.hpp
1 #pragma once
2 
3 #include <cmath>
4 
5 #include <surfaceinspector/maths/functions/IMathFunction.hpp>
6 
7 using std::exp;
8 
10 
11 namespace SurfaceInspector { namespace maths{ namespace functions{
12 
25 template <typename T>
26 class GaussianFunction : public IMathFunction<T, T>{
27 public:
28  // *** CONSTANTS *** //
29  // ******************* //
30  static T const SQRT2PI = (T) 2.5066282746310002;
31 
32  // *** ATTRIBUTES *** //
33  // ******************** //
37  T mu;
41  T sigma;
54 
55  // *** CONSTRUCTION / DESTRUCTION *** //
56  // ************************************ //
61  mu(mu),
62  sigma(sigma),
65  sqrt2PiSigma(SQRT2PI*sigma)
66  {}
72  {}
73  virtual ~GaussianFunction() = default;
74 
75  // *** MATH FUNCTION INTERFACE *** //
76  // ********************************* //
85  T operator() (T const &x) override {
86  return exp(-(x*x)/(twiceSigmaSquare))/sqrt2PiSigma;
87  }
88 };
89 }}}
Implementation of a gaussian function.
Definition: GaussianFunction.hpp:26
GaussianFunction(T mu, T sigma)
Build a gaussian function.
Definition: GaussianFunction.hpp:70
T mu
Definition: GaussianFunction.hpp:37
T operator()(T const &x) override
Definition: GaussianFunction.hpp:85
GaussianFunction(T mu, T sigma, T sigmaSquare)
Build a gaussian function.
Definition: GaussianFunction.hpp:60
T twiceSigmaSquare
Definition: GaussianFunction.hpp:49
T sigma
Definition: GaussianFunction.hpp:41
T sqrt2PiSigma
Definition: GaussianFunction.hpp:53
T sigmaSquare
Definition: GaussianFunction.hpp:45
Interface defining math function core mechanics.
Definition: IMathFunction.hpp:22