diff --git a/glm/ext/quaternion_trigonometric.inl b/glm/ext/quaternion_trigonometric.inl index 0c0bf63f..06b7c4c3 100644 --- a/glm/ext/quaternion_trigonometric.inl +++ b/glm/ext/quaternion_trigonometric.inl @@ -1,8 +1,15 @@ +#include "scalar_constants.hpp" + namespace glm { template GLM_FUNC_QUALIFIER T angle(qua const& x) { + if (abs(x.w) > cos_one_over_two()) + { + return asin(sqrt(x.x * x.x + x.y * x.y + x.z * x.z)) * static_cast(2); + } + return acos(x.w) * static_cast(2); }