From d329f06b2261b4197ca142eb2f2abe49ff048ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 19 Aug 2013 23:53:11 +0200 Subject: [PATCH] DebugTools: saved some repetitive multiplication/division. Saves ONE division. Awesome. I'm bored more. --- .../Implementation/CapsuleRendererTransformation.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DebugTools/Implementation/CapsuleRendererTransformation.h b/src/DebugTools/Implementation/CapsuleRendererTransformation.h index be649c77f..4886d3578 100644 --- a/src/DebugTools/Implementation/CapsuleRendererTransformation.h +++ b/src/DebugTools/Implementation/CapsuleRendererTransformation.h @@ -71,12 +71,13 @@ template<> std::array capsuleRendererTransformation<3>(const Vector3 Matrix4 rotation; Vector3 capDistance; if(length >= Math::TypeTraits::epsilon()) { - rotation.up() = direction/length; + const Vector3 directionNormalized = direction/length; + rotation.up() = directionNormalized; rotation.right() = Vector3::cross(rotation.up(), Vector3::zAxis()).normalized(); rotation.backward() = Vector3::cross(rotation.right(), rotation.up()); CORRADE_INTERNAL_ASSERT(rotation.up().isNormalized() && rotation.backward().isNormalized()); - capDistance = direction*(radius/length); + capDistance = directionNormalized*radius; } /* Scaling and translation of all parts */