diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-27 22:51:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-27 22:51:31 +0400 |
commit | 44b3735078c291291604671f198d8ae701f684e2 (patch) | |
tree | 0dbeb5536dfc4859b510148f9ec282583d19436a /source/blender/blenlib/intern/math_rotation.c | |
parent | d2d0866cff8a56ce3515d822d61ad40ce27180da (diff) |
fix error in own recent commit, also other minor changes.
Diffstat (limited to 'source/blender/blenlib/intern/math_rotation.c')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 44d54365e6a..38046825308 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -573,21 +573,15 @@ void interp_qt_qtqt(float result[4], const float quat1[4], const float quat2[4], { float quat[4], omega, cosom, sinom, sc1, sc2; - cosom = quat1[0] * quat2[0] + quat1[1] * quat2[1] + quat1[2] * quat2[2] + quat1[3] * quat2[3]; + cosom = dot_qtqt(quat1, quat2); /* rotate around shortest angle */ if (cosom < 0.0f) { cosom = -cosom; - quat[0] = -quat1[0]; - quat[1] = -quat1[1]; - quat[2] = -quat1[2]; - quat[3] = -quat1[3]; + negate_v4_v4(quat, quat1); } else { - quat[0] = quat1[0]; - quat[1] = quat1[1]; - quat[2] = quat1[2]; - quat[3] = quat1[3]; + copy_qt_qt(quat, quat1); } if ((1.0f - cosom) > 0.0001f) { @@ -640,7 +634,7 @@ void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const f n[0] = 1.0f; } - angle = -0.5f * (float)saacos(vec[2]); + angle = -0.5f * saacos(vec[2]); co = cosf(angle); si = sinf(angle); q1[0] = co; |