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.

203 lines
9.7 KiB

4 years ago
  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
  5. /// Permission is hereby granted, free of charge, to any person obtaining a copy
  6. /// of this software and associated documentation files (the "Software"), to deal
  7. /// in the Software without restriction, including without limitation the rights
  8. /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. /// copies of the Software, and to permit persons to whom the Software is
  10. /// furnished to do so, subject to the following conditions:
  11. ///
  12. /// The above copyright notice and this permission notice shall be included in
  13. /// all copies or substantial portions of the Software.
  14. ///
  15. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. /// THE SOFTWARE.
  22. ///
  23. /// @ref core
  24. /// @file glm/core/func_trigonometric.hpp
  25. /// @date 2008-08-01 / 2011-06-15
  26. /// @author Christophe Riccio
  27. ///
  28. /// @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>
  29. ///
  30. /// @defgroup core_func_trigonometric Angle and Trigonometry Functions
  31. /// @ingroup core
  32. ///
  33. /// Function parameters specified as angle are assumed to be in units of radians.
  34. /// In no case will any of these functions result in a divide by zero error. If
  35. /// the divisor of a ratio is 0, then results will be undefined.
  36. ///
  37. /// These all operate component-wise. The description is per component.
  38. ///////////////////////////////////////////////////////////////////////////////////
  39. #ifndef GLM_CORE_func_trigonometric
  40. #define GLM_CORE_func_trigonometric GLM_VERSION
  41. namespace glm
  42. {
  43. /// @addtogroup core_func_trigonometric
  44. /// @{
  45. /// Converts degrees to radians and returns the result.
  46. ///
  47. /// @tparam genType Floating-point scalar or vector types.
  48. ///
  49. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
  50. /// @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>
  51. template <typename genType>
  52. GLM_FUNC_DECL genType radians(genType const & degrees);
  53. /// Converts radians to degrees and returns the result.
  54. ///
  55. /// @tparam genType Floating-point scalar or vector types.
  56. ///
  57. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees 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.1 Angle and Trigonometry Functions</a>
  59. template <typename genType>
  60. GLM_FUNC_DECL genType degrees(genType const & radians);
  61. /// The standard trigonometric sine function.
  62. /// The values returned by this function will range from [-1, 1].
  63. ///
  64. /// @tparam genType Floating-point scalar or vector types.
  65. ///
  66. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
  67. /// @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>
  68. template <typename genType>
  69. GLM_FUNC_DECL genType sin(genType const & angle);
  70. /// The standard trigonometric cosine function.
  71. /// The values returned by this function will range from [-1, 1].
  72. ///
  73. /// @tparam genType Floating-point scalar or vector types.
  74. ///
  75. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
  76. /// @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>
  77. template <typename genType>
  78. GLM_FUNC_DECL genType cos(genType const & angle);
  79. /// The standard trigonometric tangent function.
  80. ///
  81. /// @tparam genType Floating-point scalar or vector types.
  82. ///
  83. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan 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 <typename genType>
  86. GLM_FUNC_DECL genType tan(genType const & angle);
  87. /// Arc sine. Returns an angle whose sine is x.
  88. /// The range of values returned by this function is [-PI/2, PI/2].
  89. /// Results are undefined if |x| > 1.
  90. ///
  91. /// @tparam genType Floating-point scalar or vector types.
  92. ///
  93. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
  94. /// @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>
  95. template <typename genType>
  96. GLM_FUNC_DECL genType asin(genType const & x);
  97. /// Arc cosine. Returns an angle whose sine is x.
  98. /// The range of values returned by this function is [0, PI].
  99. /// Results are undefined if |x| > 1.
  100. ///
  101. /// @tparam genType Floating-point scalar or vector types.
  102. ///
  103. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
  104. /// @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>
  105. template <typename genType>
  106. GLM_FUNC_DECL genType acos(genType const & x);
  107. /// Arc tangent. Returns an angle whose tangent is y/x.
  108. /// The signs of x and y are used to determine what
  109. /// quadrant the angle is in. The range of values returned
  110. /// by this function is [-PI, PI]. Results are undefined
  111. /// if x and y are both 0.
  112. ///
  113. /// @tparam genType Floating-point scalar or vector types.
  114. ///
  115. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
  116. /// @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>
  117. template <typename genType>
  118. GLM_FUNC_DECL genType atan(genType const & y, genType const & x);
  119. /// Arc tangent. Returns an angle whose tangent is y_over_x.
  120. /// The range of values returned by this function is [-PI/2, PI/2].
  121. ///
  122. /// @tparam genType Floating-point scalar or vector types.
  123. ///
  124. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
  125. /// @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>
  126. template <typename genType>
  127. GLM_FUNC_DECL genType atan(genType const & y_over_x);
  128. /// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
  129. ///
  130. /// @tparam genType Floating-point scalar or vector types.
  131. ///
  132. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
  133. /// @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>
  134. template <typename genType>
  135. GLM_FUNC_DECL genType sinh(genType const & angle);
  136. /// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
  137. ///
  138. /// @tparam genType Floating-point scalar or vector types.
  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 <typename genType>
  143. GLM_FUNC_DECL genType cosh(genType const & angle);
  144. /// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
  145. ///
  146. /// @tparam genType Floating-point scalar or vector types.
  147. ///
  148. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
  149. /// @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>
  150. template <typename genType>
  151. GLM_FUNC_DECL genType tanh(genType const & angle);
  152. /// Arc hyperbolic sine; returns the inverse of sinh.
  153. ///
  154. /// @tparam genType Floating-point scalar or vector types.
  155. ///
  156. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
  157. /// @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>
  158. template <typename genType>
  159. GLM_FUNC_DECL genType asinh(genType const & x);
  160. /// Arc hyperbolic cosine; returns the non-negative inverse
  161. /// of cosh. Results are undefined if x < 1.
  162. ///
  163. /// @tparam genType Floating-point scalar or vector types.
  164. ///
  165. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
  166. /// @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>
  167. template <typename genType>
  168. GLM_FUNC_DECL genType acosh(genType const & x);
  169. /// Arc hyperbolic tangent; returns the inverse of tanh.
  170. /// Results are undefined if abs(x) >= 1.
  171. ///
  172. /// @tparam genType Floating-point scalar or vector types.
  173. ///
  174. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
  175. /// @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>
  176. template <typename genType>
  177. GLM_FUNC_DECL genType atanh(genType const & x);
  178. /// @}
  179. }//namespace glm
  180. #include "func_trigonometric.inl"
  181. #endif//GLM_CORE_func_trigonometric