Browse Source

DebugTools: got rid of unnecessary normalization.

The tests needed slight ugly adjustment, but I can live with that.
pull/23/head
Vladimír Vondruš 13 years ago
parent
commit
c4d3446dac
  1. 3
      src/DebugTools/Implementation/ForceRendererTransformation.h
  2. 3
      src/DebugTools/Test/ForceRendererTest.cpp

3
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);

3
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<Float>::epsilon());
}
}}}}

Loading…
Cancel
Save