1 /////////////////////////////////////////////////////////////////////////////////// 2 /// OpenGL Mathematics (glm.g-truc.net) 3 /// 4 /// Copyright (c) 2005 - 2014 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 40 #ifndef GLM_CORE_func_trigonometric 41 #define GLM_CORE_func_trigonometric 42 43 namespace glm 44 { 45 /// @addtogroup core_func_trigonometric 46 /// @{ 47 48 /// Converts degrees to radians and returns the result. 49 /// 50 /// @tparam genType Floating-point scalar or vector types. 51 /// 52 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a> 53 /// @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> 54 template <typename genType> 55 GLM_FUNC_DECL genType radians(genType const & degrees); 56 57 /// Converts radians to degrees and returns the result. 58 /// 59 /// @tparam genType Floating-point scalar or vector types. 60 /// 61 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees 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 <typename genType> 64 GLM_FUNC_DECL genType degrees(genType const & radians); 65 66 /// The standard trigonometric sine function. 67 /// The values returned by this function will range from [-1, 1]. 68 /// 69 /// @tparam genType Floating-point scalar or vector types. 70 /// 71 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin 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 <typename genType> 74 GLM_FUNC_DECL genType sin(genType const & angle); 75 76 /// The standard trigonometric cosine function. 77 /// The values returned by this function will range from [-1, 1]. 78 /// 79 /// @tparam genType Floating-point scalar or vector types. 80 /// 81 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a> 82 /// @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> 83 template <typename genType> 84 GLM_FUNC_DECL genType cos(genType const & angle); 85 86 /// The standard trigonometric tangent function. 87 /// 88 /// @tparam genType Floating-point scalar or vector types. 89 /// 90 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a> 91 /// @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> 92 template <typename genType> 93 GLM_FUNC_DECL genType tan(genType const & angle); 94 95 /// Arc sine. Returns an angle whose sine is x. 96 /// The range of values returned by this function is [-PI/2, PI/2]. 97 /// Results are undefined if |x| > 1. 98 /// 99 /// @tparam genType Floating-point scalar or vector types. 100 /// 101 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a> 102 /// @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> 103 template <typename genType> 104 GLM_FUNC_DECL genType asin(genType const & x); 105 106 /// Arc cosine. Returns an angle whose sine is x. 107 /// The range of values returned by this function is [0, PI]. 108 /// Results are undefined if |x| > 1. 109 /// 110 /// @tparam genType Floating-point scalar or vector types. 111 /// 112 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a> 113 /// @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> 114 template <typename genType> 115 GLM_FUNC_DECL genType acos(genType const & x); 116 117 /// Arc tangent. Returns an angle whose tangent is y/x. 118 /// The signs of x and y are used to determine what 119 /// quadrant the angle is in. The range of values returned 120 /// by this function is [-PI, PI]. Results are undefined 121 /// if x and y are both 0. 122 /// 123 /// @tparam genType Floating-point scalar or vector types. 124 /// 125 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a> 126 /// @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> 127 template <typename genType> 128 GLM_FUNC_DECL genType atan(genType const & y, genType const & x); 129 130 /// Arc tangent. Returns an angle whose tangent is y_over_x. 131 /// The range of values returned by this function is [-PI/2, PI/2]. 132 /// 133 /// @tparam genType Floating-point scalar or vector types. 134 /// 135 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a> 136 /// @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> 137 template <typename genType> 138 GLM_FUNC_DECL genType atan(genType const & y_over_x); 139 140 /// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2 141 /// 142 /// @tparam genType Floating-point scalar or vector types. 143 /// 144 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a> 145 /// @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> 146 template <typename genType> 147 GLM_FUNC_DECL genType sinh(genType const & angle); 148 149 /// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2 150 /// 151 /// @tparam genType Floating-point scalar or vector types. 152 /// 153 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a> 154 /// @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> 155 template <typename genType> 156 GLM_FUNC_DECL genType cosh(genType const & angle); 157 158 /// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle) 159 /// 160 /// @tparam genType Floating-point scalar or vector types. 161 /// 162 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a> 163 /// @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> 164 template <typename genType> 165 GLM_FUNC_DECL genType tanh(genType const & angle); 166 167 /// Arc hyperbolic sine; returns the inverse of sinh. 168 /// 169 /// @tparam genType Floating-point scalar or vector types. 170 /// 171 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh 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 <typename genType> 174 GLM_FUNC_DECL genType asinh(genType const & x); 175 176 /// Arc hyperbolic cosine; returns the non-negative inverse 177 /// of cosh. Results are undefined if x < 1. 178 /// 179 /// @tparam genType Floating-point scalar or vector types. 180 /// 181 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a> 182 /// @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> 183 template <typename genType> 184 GLM_FUNC_DECL genType acosh(genType const & x); 185 186 /// Arc hyperbolic tangent; returns the inverse of tanh. 187 /// Results are undefined if abs(x) >= 1. 188 /// 189 /// @tparam genType Floating-point scalar or vector types. 190 /// 191 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a> 192 /// @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> 193 template <typename genType> 194 GLM_FUNC_DECL genType atanh(genType const & x); 195 196 /// @} 197 }//namespace glm 198 199 #include "func_trigonometric.inl" 200 201 #endif//GLM_CORE_func_trigonometric 202 203 204