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.

209 lines
10KB

  1. /// @ref core
  2. /// @file glm/trigonometric.hpp
  3. ///
  4. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  5. ///
  6. /// @defgroup core_func_trigonometric Angle and Trigonometry Functions
  7. /// @ingroup core
  8. ///
  9. /// Include <glm/trigonometric.hpp> to use these core features.
  10. ///
  11. /// Function parameters specified as angle are assumed to be in units of radians.
  12. /// In no case will any of these functions result in a divide by zero error. If
  13. /// the divisor of a ratio is 0, then results will be undefined.
  14. ///
  15. /// These all operate component-wise. The description is per component.
  16. #pragma once
  17. #include "detail/setup.hpp"
  18. #include "detail/qualifier.hpp"
  19. namespace glm
  20. {
  21. /// @addtogroup core_func_trigonometric
  22. /// @{
  23. /// Converts degrees to radians and returns the result.
  24. ///
  25. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  26. /// @tparam T Floating-point scalar types
  27. /// @tparam Q Value from qualifier enum
  28. ///
  29. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians 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.1 Angle and Trigonometry Functions</a>
  31. template<length_t L, typename T, qualifier Q>
  32. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> radians(vec<L, T, Q> const& degrees);
  33. /// Converts radians to degrees and returns the result.
  34. ///
  35. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  36. /// @tparam T Floating-point scalar types
  37. /// @tparam Q Value from qualifier enum
  38. ///
  39. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees 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.1 Angle and Trigonometry Functions</a>
  41. template<length_t L, typename T, qualifier Q>
  42. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> degrees(vec<L, T, Q> const& radians);
  43. /// The standard trigonometric sine function.
  44. /// The values returned by this function will range from [-1, 1].
  45. ///
  46. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  47. /// @tparam T Floating-point scalar types
  48. /// @tparam Q Value from qualifier enum
  49. ///
  50. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
  51. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  52. template<length_t L, typename T, qualifier Q>
  53. GLM_FUNC_DECL vec<L, T, Q> sin(vec<L, T, Q> const& angle);
  54. /// The standard trigonometric cosine function.
  55. /// The values returned by this function will range from [-1, 1].
  56. ///
  57. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  58. /// @tparam T Floating-point scalar types
  59. /// @tparam Q Value from qualifier enum
  60. ///
  61. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos 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.1 Angle and Trigonometry Functions</a>
  63. template<length_t L, typename T, qualifier Q>
  64. GLM_FUNC_DECL vec<L, T, Q> cos(vec<L, T, Q> const& angle);
  65. /// The standard trigonometric tangent function.
  66. ///
  67. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  68. /// @tparam T Floating-point scalar types
  69. /// @tparam Q Value from qualifier enum
  70. ///
  71. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
  72. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  73. template<length_t L, typename T, qualifier Q>
  74. GLM_FUNC_DECL vec<L, T, Q> tan(vec<L, T, Q> const& angle);
  75. /// Arc sine. Returns an angle whose sine is x.
  76. /// The range of values returned by this function is [-PI/2, PI/2].
  77. /// Results are undefined if |x| > 1.
  78. ///
  79. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  80. /// @tparam T Floating-point scalar types
  81. /// @tparam Q Value from qualifier enum
  82. ///
  83. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
  84. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  85. template<length_t L, typename T, qualifier Q>
  86. GLM_FUNC_DECL vec<L, T, Q> asin(vec<L, T, Q> const& x);
  87. /// Arc cosine. Returns an angle whose sine is x.
  88. /// The range of values returned by this function is [0, PI].
  89. /// Results are undefined if |x| > 1.
  90. ///
  91. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  92. /// @tparam T Floating-point scalar types
  93. /// @tparam Q Value from qualifier enum
  94. ///
  95. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
  96. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  97. template<length_t L, typename T, qualifier Q>
  98. GLM_FUNC_DECL vec<L, T, Q> acos(vec<L, T, Q> const& x);
  99. /// Arc tangent. Returns an angle whose tangent is y/x.
  100. /// The signs of x and y are used to determine what
  101. /// quadrant the angle is in. The range of values returned
  102. /// by this function is [-PI, PI]. Results are undefined
  103. /// if x and y are both 0.
  104. ///
  105. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  106. /// @tparam T Floating-point scalar types
  107. /// @tparam Q Value from qualifier enum
  108. ///
  109. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
  110. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  111. template<length_t L, typename T, qualifier Q>
  112. GLM_FUNC_DECL vec<L, T, Q> atan(vec<L, T, Q> const& y, vec<L, T, Q> const& x);
  113. /// Arc tangent. Returns an angle whose tangent is y_over_x.
  114. /// The range of values returned by this function is [-PI/2, PI/2].
  115. ///
  116. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  117. /// @tparam T Floating-point scalar types
  118. /// @tparam Q Value from qualifier enum
  119. ///
  120. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
  121. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  122. template<length_t L, typename T, qualifier Q>
  123. GLM_FUNC_DECL vec<L, T, Q> atan(vec<L, T, Q> const& y_over_x);
  124. /// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
  125. ///
  126. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  127. /// @tparam T Floating-point scalar types
  128. /// @tparam Q Value from qualifier enum
  129. ///
  130. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
  131. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  132. template<length_t L, typename T, qualifier Q>
  133. GLM_FUNC_DECL vec<L, T, Q> sinh(vec<L, T, Q> const& angle);
  134. /// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
  135. ///
  136. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  137. /// @tparam T Floating-point scalar types
  138. /// @tparam Q Value from qualifier enum
  139. ///
  140. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
  141. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  142. template<length_t L, typename T, qualifier Q>
  143. GLM_FUNC_DECL vec<L, T, Q> cosh(vec<L, T, Q> const& angle);
  144. /// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
  145. ///
  146. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  147. /// @tparam T Floating-point scalar types
  148. /// @tparam Q Value from qualifier enum
  149. ///
  150. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
  151. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  152. template<length_t L, typename T, qualifier Q>
  153. GLM_FUNC_DECL vec<L, T, Q> tanh(vec<L, T, Q> const& angle);
  154. /// Arc hyperbolic sine; returns the inverse of sinh.
  155. ///
  156. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  157. /// @tparam T Floating-point scalar types
  158. /// @tparam Q Value from qualifier enum
  159. ///
  160. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
  161. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  162. template<length_t L, typename T, qualifier Q>
  163. GLM_FUNC_DECL vec<L, T, Q> asinh(vec<L, T, Q> const& x);
  164. /// Arc hyperbolic cosine; returns the non-negative inverse
  165. /// of cosh. Results are undefined if x < 1.
  166. ///
  167. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  168. /// @tparam T Floating-point scalar types
  169. /// @tparam Q Value from qualifier enum
  170. ///
  171. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
  172. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  173. template<length_t L, typename T, qualifier Q>
  174. GLM_FUNC_DECL vec<L, T, Q> acosh(vec<L, T, Q> const& x);
  175. /// Arc hyperbolic tangent; returns the inverse of tanh.
  176. /// Results are undefined if abs(x) >= 1.
  177. ///
  178. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  179. /// @tparam T Floating-point scalar types
  180. /// @tparam Q Value from qualifier enum
  181. ///
  182. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
  183. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
  184. template<length_t L, typename T, qualifier Q>
  185. GLM_FUNC_DECL vec<L, T, Q> atanh(vec<L, T, Q> const& x);
  186. /// @}
  187. }//namespace glm
  188. #include "detail/func_trigonometric.inl"