diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 552ea33c..240f3d12 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -18,6 +18,7 @@ #include "../mat4x4.hpp" #include "../vec3.hpp" #include "../vec4.hpp" +#include "../ext/vector_relational.hpp" #include "../gtc/constants.hpp" #include "../gtc/matrix_transform.hpp" diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 953c53f7..f235e173 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -603,13 +603,13 @@ namespace detail GLM_FUNC_QUALIFIER T pitch(tquat const& q) { //return T(atan(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z)); - const T y = static_cast(2) * (q.y * q.z + q.w * q.x); - const T x = q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z; + T const y = static_cast(2) * (q.y * q.z + q.w * q.x); + T const x = q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z; - if(detail::compute_equal::is_iec559>::call(y, static_cast(0)) && detail::compute_equal::is_iec559>::call(x, static_cast(0))) //avoid atan2(0,0) - handle singularity - Matiis - return static_cast(static_cast(2) * atan(q.x,q.w)); + if(all(equal(vec<2, T, Q>(x, y), vec<2, T, Q>(0), epsilon()))) //avoid atan2(0,0) - handle singularity - Matiis + return static_cast(static_cast(2) * atan(q.x, q.w)); - return static_cast(atan(y,x)); + return static_cast(atan(y, x)); } template diff --git a/test/ext/ext_vec1.cpp b/test/ext/ext_vec1.cpp index e71b4aec..1da80a66 100644 --- a/test/ext/ext_vec1.cpp +++ b/test/ext/ext_vec1.cpp @@ -10,8 +10,8 @@ static int test_vec1_operators() { int Error(0); - glm::ivec1 A(1.0f); - glm::ivec1 B(1.0f); + glm::ivec1 A(1); + glm::ivec1 B(1); { bool R = A != B; bool S = A == B;