Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
805B

  1. /// @ref gtx_functions
  2. /// @file glm/gtx/functions.inl
  3. #include "../exponential.hpp"
  4. namespace glm
  5. {
  6. template<typename T>
  7. GLM_FUNC_QUALIFIER T gauss
  8. (
  9. T x,
  10. T ExpectedValue,
  11. T StandardDeviation
  12. )
  13. {
  14. return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast<T>(6.28318530717958647692528676655900576)));
  15. }
  16. template<typename T, qualifier Q>
  17. GLM_FUNC_QUALIFIER T gauss
  18. (
  19. vec<2, T, Q> const& Coord,
  20. vec<2, T, Q> const& ExpectedValue,
  21. vec<2, T, Q> const& StandardDeviation
  22. )
  23. {
  24. vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation);
  25. return exp(-(Squared.x + Squared.y));
  26. }
  27. }//namespace glm