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