summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorleo2005-02-08 22:53:13 +0000
committerleo2005-02-08 22:53:13 +0000
commitb8ab42ca9ac2b2e8cd5e10b3fa6fe13b08dc3e44 (patch)
tree4208814c8fdc8d6f2d07043e3b5f546143de29a7 /common
parentbfe0fb1e139839503b54c879cb15fad7f2d66187 (diff)
Fixed a rotation bug that would cause pieces to disappear.
git-svn-id: http://svn.leocad.org/trunk@374 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common')
-rw-r--r--common/matrix.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/matrix.cpp b/common/matrix.cpp
index 27a199a..e69e870 100644
--- a/common/matrix.cpp
+++ b/common/matrix.cpp
@@ -427,6 +427,12 @@ void Matrix::ToAxisAngle (float *rot) const
{
float fTrace = m[0] + m[5] + m[10];
float inv, fCos = 0.5f * (fTrace - 1.0f);
+
+ while (fCos < -1.0f)
+ fCos += 2.0f;
+ while (fCos > 1.0f)
+ fCos -= 2.0f;
+
rot[3] = (float)acos (fCos); // in [0,PI]
if (rot[3] > 0.01f)