master
ブランチ master
VulkanExample / dep / include / glm / trigonometric.hpp
10.6 KB、210行 生 Blame 履歴
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/// 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/// Include <glm/trigonometric.hpp> to use these core features.
16///
17/// @see ext_vector_trigonometric
18
19#pragma once
20
21#include "detail/setup.hpp"
22#include "detail/qualifier.hpp"
23
24namespace glm
25{
26 /// @addtogroup core_func_trigonometric
27 /// @{
28
29 /// Converts degrees to radians and returns the result.
30 ///
31 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
32 /// @tparam T Floating-point scalar types
33 /// @tparam Q Value from qualifier enum
34 ///
35 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians 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.1 Angle and Trigonometry Functions</a>
37 template<length_t L, typename T, qualifier Q>
38 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> radians(vec<L, T, Q> const& degrees);
39
40 /// Converts radians to degrees and returns the result.
41 ///
42 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
43 /// @tparam T Floating-point scalar types
44 /// @tparam Q Value from qualifier enum
45 ///
46 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
47 /// @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>
48 template<length_t L, typename T, qualifier Q>
49 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> degrees(vec<L, T, Q> const& radians);
50
51 /// The standard trigonometric sine function.
52 /// The values returned by this function will range from [-1, 1].
53 ///
54 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
55 /// @tparam T Floating-point scalar types
56 /// @tparam Q Value from qualifier enum
57 ///
58 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin 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<length_t L, typename T, qualifier Q>
61 GLM_FUNC_DECL vec<L, T, Q> sin(vec<L, T, Q> const& angle);
62
63 /// The standard trigonometric cosine function.
64 /// The values returned by this function will range from [-1, 1].
65 ///
66 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
67 /// @tparam T Floating-point scalar types
68 /// @tparam Q Value from qualifier enum
69 ///
70 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
71 /// @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>
72 template<length_t L, typename T, qualifier Q>
73 GLM_FUNC_DECL vec<L, T, Q> cos(vec<L, T, Q> const& angle);
74
75 /// The standard trigonometric tangent function.
76 ///
77 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
78 /// @tparam T Floating-point scalar types
79 /// @tparam Q Value from qualifier enum
80 ///
81 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan 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<length_t L, typename T, qualifier Q>
84 GLM_FUNC_DECL vec<L, T, Q> tan(vec<L, T, Q> const& angle);
85
86 /// Arc sine. Returns an angle whose sine is x.
87 /// The range of values returned by this function is [-PI/2, PI/2].
88 /// Results are undefined if |x| > 1.
89 ///
90 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
91 /// @tparam T Floating-point scalar types
92 /// @tparam Q Value from qualifier enum
93 ///
94 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
95 /// @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>
96 template<length_t L, typename T, qualifier Q>
97 GLM_FUNC_DECL vec<L, T, Q> asin(vec<L, T, Q> const& x);
98
99 /// Arc cosine. Returns an angle whose cosine is x.
100 /// The range of values returned by this function is [0, PI].
101 /// Results are undefined if |x| > 1.
102 ///
103 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
104 /// @tparam T Floating-point scalar types
105 /// @tparam Q Value from qualifier enum
106 ///
107 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
108 /// @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>
109 template<length_t L, typename T, qualifier Q>
110 GLM_FUNC_DECL vec<L, T, Q> acos(vec<L, T, Q> const& x);
111
112 /// Arc tangent. Returns an angle whose tangent is y/x.
113 /// The signs of x and y are used to determine what
114 /// quadrant the angle is in. The range of values returned
115 /// by this function is [-PI, PI]. Results are undefined
116 /// if x and y are both 0.
117 ///
118 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
119 /// @tparam T Floating-point scalar types
120 /// @tparam Q Value from qualifier enum
121 ///
122 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
123 /// @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>
124 template<length_t L, typename T, qualifier Q>
125 GLM_FUNC_DECL vec<L, T, Q> atan(vec<L, T, Q> const& y, vec<L, T, Q> const& x);
126
127 /// Arc tangent. Returns an angle whose tangent is y_over_x.
128 /// The range of values returned by this function is [-PI/2, PI/2].
129 ///
130 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
131 /// @tparam T Floating-point scalar types
132 /// @tparam Q Value from qualifier enum
133 ///
134 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
135 /// @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>
136 template<length_t L, typename T, qualifier Q>
137 GLM_FUNC_DECL vec<L, T, Q> atan(vec<L, T, Q> const& y_over_x);
138
139 /// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
140 ///
141 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
142 /// @tparam T Floating-point scalar types
143 /// @tparam Q Value from qualifier enum
144 ///
145 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
146 /// @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>
147 template<length_t L, typename T, qualifier Q>
148 GLM_FUNC_DECL vec<L, T, Q> sinh(vec<L, T, Q> const& angle);
149
150 /// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
151 ///
152 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
153 /// @tparam T Floating-point scalar types
154 /// @tparam Q Value from qualifier enum
155 ///
156 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh 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<length_t L, typename T, qualifier Q>
159 GLM_FUNC_DECL vec<L, T, Q> cosh(vec<L, T, Q> const& angle);
160
161 /// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
162 ///
163 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
164 /// @tparam T Floating-point scalar types
165 /// @tparam Q Value from qualifier enum
166 ///
167 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
168 /// @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>
169 template<length_t L, typename T, qualifier Q>
170 GLM_FUNC_DECL vec<L, T, Q> tanh(vec<L, T, Q> const& angle);
171
172 /// Arc hyperbolic sine; returns the inverse of sinh.
173 ///
174 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
175 /// @tparam T Floating-point scalar types
176 /// @tparam Q Value from qualifier enum
177 ///
178 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
179 /// @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>
180 template<length_t L, typename T, qualifier Q>
181 GLM_FUNC_DECL vec<L, T, Q> asinh(vec<L, T, Q> const& x);
182
183 /// Arc hyperbolic cosine; returns the non-negative inverse
184 /// of cosh. Results are undefined if x < 1.
185 ///
186 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
187 /// @tparam T Floating-point scalar types
188 /// @tparam Q Value from qualifier enum
189 ///
190 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
191 /// @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>
192 template<length_t L, typename T, qualifier Q>
193 GLM_FUNC_DECL vec<L, T, Q> acosh(vec<L, T, Q> const& x);
194
195 /// Arc hyperbolic tangent; returns the inverse of tanh.
196 /// Results are undefined if abs(x) >= 1.
197 ///
198 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
199 /// @tparam T Floating-point scalar types
200 /// @tparam Q Value from qualifier enum
201 ///
202 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
203 /// @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>
204 template<length_t L, typename T, qualifier Q>
205 GLM_FUNC_DECL vec<L, T, Q> atanh(vec<L, T, Q> const& x);
206
207 /// @}
208}//namespace glm
209
210#include "detail/func_trigonometric.inl"