exponential.hpp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /// @ref core
  2. /// @file glm/exponential.hpp
  3. ///
  4. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
  5. ///
  6. /// @defgroup core_func_exponential Exponential functions
  7. /// @ingroup core
  8. ///
  9. /// Provides GLSL exponential functions
  10. ///
  11. /// These all operate component-wise. The description is per component.
  12. ///
  13. /// Include <glm/exponential.hpp> to use these core features.
  14. #pragma once
  15. #include "detail/type_vec1.hpp"
  16. #include "detail/type_vec2.hpp"
  17. #include "detail/type_vec3.hpp"
  18. #include "detail/type_vec4.hpp"
  19. #include <cmath>
  20. namespace glm
  21. {
  22. /// @addtogroup core_func_exponential
  23. /// @{
  24. /// Returns 'base' raised to the power 'exponent'.
  25. ///
  26. /// @param base Floating point value. pow function is defined for input values of 'base' defined in the range (inf-, inf+) in the limit of the type qualifier.
  27. /// @param exponent Floating point value representing the 'exponent'.
  28. ///
  29. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
  30. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
  31. template<length_t L, typename T, qualifier Q>
  32. GLM_FUNC_DECL vec<L, T, Q> pow(vec<L, T, Q> const& base, vec<L, T, Q> const& exponent);
  33. /// Returns the natural exponentiation of x, i.e., e^x.
  34. ///
  35. /// @param v exp function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.
  36. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  37. /// @tparam T Floating-point scalar types.
  38. ///
  39. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
  40. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
  41. template<length_t L, typename T, qualifier Q>
  42. GLM_FUNC_DECL vec<L, T, Q> exp(vec<L, T, Q> const& v);
  43. /// Returns the natural logarithm of v, i.e.,
  44. /// returns the value y which satisfies the equation x = e^y.
  45. /// Results are undefined if v <= 0.
  46. ///
  47. /// @param v log function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.
  48. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  49. /// @tparam T Floating-point scalar types.
  50. ///
  51. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
  52. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
  53. template<length_t L, typename T, qualifier Q>
  54. GLM_FUNC_DECL vec<L, T, Q> log(vec<L, T, Q> const& v);
  55. /// Returns 2 raised to the v power.
  56. ///
  57. /// @param v exp2 function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.
  58. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  59. /// @tparam T Floating-point scalar types.
  60. ///
  61. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
  62. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
  63. template<length_t L, typename T, qualifier Q>
  64. GLM_FUNC_DECL vec<L, T, Q> exp2(vec<L, T, Q> const& v);
  65. /// Returns the base 2 log of x, i.e., returns the value y,
  66. /// which satisfies the equation x = 2 ^ y.
  67. ///
  68. /// @param v log2 function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.
  69. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  70. /// @tparam T Floating-point scalar types.
  71. ///
  72. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
  73. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
  74. template<length_t L, typename T, qualifier Q>
  75. GLM_FUNC_DECL vec<L, T, Q> log2(vec<L, T, Q> const& v);
  76. /// Returns the positive square root of v.
  77. ///
  78. /// @param v sqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.
  79. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  80. /// @tparam T Floating-point scalar types.
  81. ///
  82. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
  83. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
  84. template<length_t L, typename T, qualifier Q>
  85. GLM_FUNC_DECL vec<L, T, Q> sqrt(vec<L, T, Q> const& v);
  86. /// Returns the reciprocal of the positive square root of v.
  87. ///
  88. /// @param v inversesqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.
  89. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  90. /// @tparam T Floating-point scalar types.
  91. ///
  92. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
  93. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
  94. template<length_t L, typename T, qualifier Q>
  95. GLM_FUNC_DECL vec<L, T, Q> inversesqrt(vec<L, T, Q> const& v);
  96. /// @}
  97. }//namespace glm
  98. #include "detail/func_exponential.inl"