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()); } }}}}