From e63991581a268f3eb85f86782d0bdf3687695795 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Wed, 16 Dec 2015 15:28:23 +0100 Subject: [PATCH] Fixed GLM quaternion floating point error edge case when converting to euler angles --- include/glm/gtc/quaternion.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/glm/gtc/quaternion.inl b/include/glm/gtc/quaternion.inl index 4c8565b..284f4fe 100644 --- a/include/glm/gtc/quaternion.inl +++ b/include/glm/gtc/quaternion.inl @@ -591,7 +591,7 @@ namespace detail template GLM_FUNC_QUALIFIER T yaw(tquat const & q) { - return asin(T(-2) * (q.x * q.z - q.w * q.y)); + return asin(clamp(T(-2) * (q.x * q.z - q.w * q.y), T(-1), T(1))); } template