From e80bafdf6639429193ca5601d195c54f7793a416 Mon Sep 17 00:00:00 2001 From: Michael Korn Date: Fri, 4 Mar 2016 22:01:29 +0100 Subject: [PATCH] fix for issue in getAngleShortestPath() Testing squared norm for <0 does not make any sense. In Addition giving the range of the return values is a great help to understand the descriptions. --- src/LinearMath/btQuaternion.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/LinearMath/btQuaternion.h b/src/LinearMath/btQuaternion.h index ede769384..f7dafcc83 100644 --- a/src/LinearMath/btQuaternion.h +++ b/src/LinearMath/btQuaternion.h @@ -418,22 +418,21 @@ public: return btAcos(dot(q) / s) * btScalar(2.0); } - /**@brief Return the angle of rotation represented by this quaternion */ + /**@brief Return the angle [0, 2Pi] of rotation represented by this quaternion */ btScalar getAngle() const { btScalar s = btScalar(2.) * btAcos(m_floats[3]); return s; } - /**@brief Return the angle of rotation represented by this quaternion along the shortest path*/ + /**@brief Return the angle [0, Pi] of rotation represented by this quaternion along the shortest path */ btScalar getAngleShortestPath() const { btScalar s; - if (dot(*this) < 0) + if (m_floats[3] >= 0) s = btScalar(2.) * btAcos(m_floats[3]); else s = btScalar(2.) * btAcos(-m_floats[3]); - return s; }