From 425d31fb5cfc757835bfeded0f943bb06e42505e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 3 Sep 2018 14:51:02 +0200 Subject: [PATCH] Math: no, this is testing it wrong. And causes an assertion message. Obviously the test doesn't pass anymore after this fix. --- src/Magnum/Math/Test/DualQuaternionTest.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Magnum/Math/Test/DualQuaternionTest.cpp b/src/Magnum/Math/Test/DualQuaternionTest.cpp index 17b062651..9b241b99d 100644 --- a/src/Magnum/Math/Test/DualQuaternionTest.cpp +++ b/src/Magnum/Math/Test/DualQuaternionTest.cpp @@ -506,13 +506,14 @@ void DualQuaternionTest::sclerp() { /* Dual quaternions with identical rotation */ CORRADE_COMPARE(Math::sclerp(from, from, 0.42f), from); - CORRADE_COMPARE(Math::sclerp(from, {-from.real(), from.dual()}, 0.42f), from); + CORRADE_COMPARE(Math::sclerp(from, -from, 0.42f), from); /* No difference in rotation, but in translation */ - const auto rotation = DualQuaternion::rotation(35.0_degf, {0.3f, 0.2f, 0.1f}); - CORRADE_COMPARE(Math::sclerp( - DualQuaternion::translation({1.0f, 2.0f, 4.0f})*rotation, DualQuaternion::translation({5.0f, -6.0f, 2.0f})*rotation, 0.25f), - DualQuaternion::translation({2.0f, 0.0f, 3.5f})*rotation); + auto rotation = DualQuaternion::rotation(35.0_degf, Vector3{0.3f, 0.2f, 0.1f}.normalized()); + auto interpolateTranslation = Math::sclerp( + DualQuaternion::translation({1.0f, 2.0f, 4.0f})*rotation, DualQuaternion::translation({5.0f, -6.0f, 2.0f})*rotation, 0.25f); + CORRADE_VERIFY(interpolateTranslation.isNormalized()); + CORRADE_COMPARE(interpolateTranslation, DualQuaternion::translation({2.0f, 0.0f, 3.5f})*rotation); } void DualQuaternionTest::debug() {