func_exponential.hpp 5.4 KB

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