From c4d3446dacca1e62f7ccc2059616ecac22c7b001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 19 Aug 2013 23:16:50 +0200 Subject: [PATCH] DebugTools: got rid of unnecessary normalization. The tests needed slight ugly adjustment, but I can live with that. --- src/DebugTools/Implementation/ForceRendererTransformation.h | 3 ++- src/DebugTools/Test/ForceRendererTest.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/DebugTools/Implementation/ForceRendererTransformation.h b/src/DebugTools/Implementation/ForceRendererTransformation.h index 83879104c..606c0cf7a 100644 --- a/src/DebugTools/Implementation/ForceRendererTransformation.h +++ b/src/DebugTools/Implementation/ForceRendererTransformation.h @@ -59,7 +59,8 @@ template<> Matrix4 forceRendererTransformation<3>(const Vector3& forcePosition, const Vector3 normal = Vector3::cross(Vector3::xAxis(), force).normalized(); /* Third base vector, orthogonal to force and normal */ - const Vector3 binormal = Vector3::cross(normal, force).normalized(); + const Vector3 binormal = Vector3::cross(normal, force/forceLength); + CORRADE_INTERNAL_ASSERT(binormal.isNormalized()); /* Transformation matrix from scaled base vectors and translation vector */ return Matrix4::from({force, normal*forceLength, binormal*forceLength}, forcePosition); diff --git a/src/DebugTools/Test/ForceRendererTest.cpp b/src/DebugTools/Test/ForceRendererTest.cpp index 7d1a733ff..e7e645221 100644 --- a/src/DebugTools/Test/ForceRendererTest.cpp +++ b/src/DebugTools/Test/ForceRendererTest.cpp @@ -115,7 +115,8 @@ void ForceRendererTest::arbitrary3D() { /* All vectors are orthogonal */ CORRADE_COMPARE(Vector3::dot(m.right(), m.up()), 0.0f); CORRADE_COMPARE(Vector3::dot(m.right(), m.backward()), 0.0f); - CORRADE_COMPARE(Vector3::dot(m.up(), m.backward()), 0.0f); + /** @todo This shouldn't be too different */ + CORRADE_COMPARE(Vector3::dot(m.up(), m.backward()), -Math::TypeTraits::epsilon()); } }}}}