master
ブランチ master
VulkanExample / dep / include / glm / ext / quaternion_common.hpp
4.9 KB、135行 生 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 GLM_CONSTEXPR 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 /// Spherical linear interpolation of two quaternions with multiple spins over rotation axis.
80 /// The interpolation always take the short path when the spin count is positive and long path
81 /// when count is negative. Rotation is performed at constant speed.
82 ///
83 /// @param x A quaternion
84 /// @param y A quaternion
85 /// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
86 /// @param k Additional spin count. If Value is negative interpolation will be on "long" path.
87 ///
88 /// @tparam T A floating-point scalar type
89 /// @tparam S An integer scalar type
90 /// @tparam Q A value from qualifier enum
91 template<typename T, typename S, qualifier Q>
92 GLM_FUNC_DECL qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a, S k);
93
94 /// Returns the q conjugate.
95 ///
96 /// @tparam T A floating-point scalar type
97 /// @tparam Q A value from qualifier enum
98 template<typename T, qualifier Q>
99 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> conjugate(qua<T, Q> const& q);
100
101 /// Returns the q inverse.
102 ///
103 /// @tparam T A floating-point scalar type
104 /// @tparam Q A value from qualifier enum
105 template<typename T, qualifier Q>
106 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> inverse(qua<T, Q> const& q);
107
108 /// Returns true if x holds a NaN (not a number)
109 /// representation in the underlying implementation's set of
110 /// floating point representations. Returns false otherwise,
111 /// including for implementations with no NaN
112 /// representations.
113 ///
114 /// /!\ When using compiler fast math, this function may fail.
115 ///
116 /// @tparam T A floating-point scalar type
117 /// @tparam Q A value from qualifier enum
118 template<typename T, qualifier Q>
119 GLM_FUNC_DECL vec<4, bool, Q> isnan(qua<T, Q> const& x);
120
121 /// Returns true if x holds a positive infinity or negative
122 /// infinity representation in the underlying implementation's
123 /// set of floating point representations. Returns false
124 /// otherwise, including for implementations with no infinity
125 /// representations.
126 ///
127 /// @tparam T A floating-point scalar type
128 /// @tparam Q A value from qualifier enum
129 template<typename T, qualifier Q>
130 GLM_FUNC_DECL vec<4, bool, Q> isinf(qua<T, Q> const& x);
131
132 /// @}
133} //namespace glm
134
135#include "quaternion_common.inl"