master
ブランチ master
ShaderPlayground / deps / glm / glm / ext / quaternion_common.hpp
3.9 KB、120行 生 Blame 履歴
1/// @ref ext_quaternion_common
2/// @file glm/ext/quaternion_common.hpp
3///
4/// @defgroup ext_quaternion_common GLM_EXT_quaternion_common
5/// @ingroup ext
6///
7/// Provides common functions for quaternion types
8///
9/// Include <glm/ext/quaternion_common.hpp> to use the features of this extension.
10///
11/// @see ext_scalar_common
12/// @see ext_vector_common
13/// @see ext_quaternion_float
14/// @see ext_quaternion_double
15/// @see ext_quaternion_exponential
16/// @see ext_quaternion_geometric
17/// @see ext_quaternion_relational
18/// @see ext_quaternion_trigonometric
19/// @see ext_quaternion_transform
20
21#pragma once
22
23// Dependency:
24#include "../ext/scalar_constants.hpp"
25#include "../ext/quaternion_geometric.hpp"
26#include "../common.hpp"
27#include "../trigonometric.hpp"
28#include "../exponential.hpp"
29#include <limits>
30
31#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
32# pragma message("GLM: GLM_EXT_quaternion_common extension included")
33#endif
34
35namespace glm
36{
37 /// @addtogroup ext_quaternion_common
38 /// @{
39
40 /// Spherical linear interpolation of two quaternions.
41 /// The interpolation is oriented and the rotation is performed at constant speed.
42 /// For short path spherical linear interpolation, use the slerp function.
43 ///
44 /// @param x A quaternion
45 /// @param y A quaternion
46 /// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
47 ///
48 /// @tparam T A floating-point scalar type
49 /// @tparam Q A value from qualifier enum
50 ///
51 /// @see - slerp(qua<T, Q> const& x, qua<T, Q> const& y, T const& a)
52 template<typename T, qualifier Q>
53 GLM_FUNC_DECL qua<T, Q> mix(qua<T, Q> const& x, qua<T, Q> const& y, T a);
54
55 /// Linear interpolation of two quaternions.
56 /// The interpolation is oriented.
57 ///
58 /// @param x A quaternion
59 /// @param y A quaternion
60 /// @param a Interpolation factor. The interpolation is defined in the range [0, 1].
61 ///
62 /// @tparam T A floating-point scalar type
63 /// @tparam Q A value from qualifier enum
64 template<typename T, qualifier Q>
65 GLM_FUNC_DECL qua<T, Q> lerp(qua<T, Q> const& x, qua<T, Q> const& y, T a);
66
67 /// Spherical linear interpolation of two quaternions.
68 /// The interpolation always take the short path and the rotation is performed at constant speed.
69 ///
70 /// @param x A quaternion
71 /// @param y A quaternion
72 /// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
73 ///
74 /// @tparam T A floating-point scalar type
75 /// @tparam Q A value from qualifier enum
76 template<typename T, qualifier Q>
77 GLM_FUNC_DECL qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a);
78
79 /// Returns the q conjugate.
80 ///
81 /// @tparam T A floating-point scalar type
82 /// @tparam Q A value from qualifier enum
83 template<typename T, qualifier Q>
84 GLM_FUNC_DECL qua<T, Q> conjugate(qua<T, Q> const& q);
85
86 /// Returns the q inverse.
87 ///
88 /// @tparam T A floating-point scalar type
89 /// @tparam Q A value from qualifier enum
90 template<typename T, qualifier Q>
91 GLM_FUNC_DECL qua<T, Q> inverse(qua<T, Q> const& q);
92
93 /// Returns true if x holds a NaN (not a number)
94 /// representation in the underlying implementation's set of
95 /// floating point representations. Returns false otherwise,
96 /// including for implementations with no NaN
97 /// representations.
98 ///
99 /// /!\ When using compiler fast math, this function may fail.
100 ///
101 /// @tparam T A floating-point scalar type
102 /// @tparam Q A value from qualifier enum
103 template<typename T, qualifier Q>
104 GLM_FUNC_DECL vec<4, bool, Q> isnan(qua<T, Q> const& x);
105
106 /// Returns true if x holds a positive infinity or negative
107 /// infinity representation in the underlying implementation's
108 /// set of floating point representations. Returns false
109 /// otherwise, including for implementations with no infinity
110 /// representations.
111 ///
112 /// @tparam T A floating-point scalar type
113 /// @tparam Q A value from qualifier enum
114 template<typename T, qualifier Q>
115 GLM_FUNC_DECL vec<4, bool, Q> isinf(qua<T, Q> const& x);
116
117 /// @}
118} //namespace glm
119
120#include "quaternion_common.inl"