From b0d79bbad8c0dd8349a461efd76c0eaa06dbf469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 27 Feb 2013 11:45:06 +0100 Subject: [PATCH] Math: minor code cleanup. --- src/Math/DualQuaternion.h | 4 ++-- src/Math/Math.h | 4 ++-- src/Math/Test/CMakeLists.txt | 4 ++-- src/Math/Test/DualQuaternionTest.cpp | 1 - src/Math/Test/QuaternionTest.cpp | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Math/DualQuaternion.h b/src/Math/DualQuaternion.h index 8c2e87b82..6ebbd74ea 100644 --- a/src/Math/DualQuaternion.h +++ b/src/Math/DualQuaternion.h @@ -239,7 +239,7 @@ template class DualQuaternion: public Dual> { * @see inverted() */ inline DualQuaternion invertedNormalized() const { - CORRADE_ASSERT(MathTypeTraits::equals(lengthSquared(), T(1)), + CORRADE_ASSERT(lengthSquared() == Dual(1), "Math::DualQuaternion::invertedNormalized(): dual quaternion must be normalized", {}); return quaternionConjugated(); } @@ -269,7 +269,7 @@ template class DualQuaternion: public Dual> { * Quaternion::transformVectorNormalized() */ inline Vector3 transformPointNormalized(const Vector3& vector) const { - CORRADE_ASSERT(MathTypeTraits>::equals(lengthSquared(), Dual(1)), + CORRADE_ASSERT(lengthSquared() == Dual(1), "Math::DualQuaternion::transformPointNormalized(): dual quaternion must be normalized", Vector3(std::numeric_limits::quiet_NaN())); return ((*this)*DualQuaternion(vector)*conjugated()).dual().vector(); diff --git a/src/Math/Math.h b/src/Math/Math.h index 2f11f3023..a05da0a1c 100644 --- a/src/Math/Math.h +++ b/src/Math/Math.h @@ -27,8 +27,8 @@ namespace Magnum { namespace Math { #ifndef DOXYGEN_GENERATING_OUTPUT /* Class Constants used only statically */ -template class Complex; -template class Dual; +template class Complex; +template class Dual; template class DualQuaternion; template class Matrix; diff --git a/src/Math/Test/CMakeLists.txt b/src/Math/Test/CMakeLists.txt index 76d7980dc..e0e8b22be 100644 --- a/src/Math/Test/CMakeLists.txt +++ b/src/Math/Test/CMakeLists.txt @@ -17,8 +17,8 @@ corrade_add_test(MathSwizzleTest SwizzleTest.cpp LIBRARIES MagnumMathTestLib) corrade_add_test(MathUnitTest UnitTest.cpp) corrade_add_test(MathAngleTest AngleTest.cpp LIBRARIES MagnumMathTestLib) -corrade_add_test(MathComplexTest ComplexTest.cpp LIBRARIES MagnumMathTestLib) corrade_add_test(MathDualTest DualTest.cpp) +corrade_add_test(MathComplexTest ComplexTest.cpp LIBRARIES MagnumMathTestLib) corrade_add_test(MathQuaternionTest QuaternionTest.cpp LIBRARIES MagnumMathTestLib) corrade_add_test(MathDualQuaternionTest DualQuaternionTest.cpp LIBRARIES MagnumMathTestLib) @@ -27,6 +27,6 @@ set_target_properties( MathMatrix3Test MathMatrix4Test MathComplexTest - MathDualQuaternionTest MathQuaternionTest + MathDualQuaternionTest PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) diff --git a/src/Math/Test/DualQuaternionTest.cpp b/src/Math/Test/DualQuaternionTest.cpp index da954935f..0a49372ab 100644 --- a/src/Math/Test/DualQuaternionTest.cpp +++ b/src/Math/Test/DualQuaternionTest.cpp @@ -56,7 +56,6 @@ typedef Math::Matrix4 Matrix4; typedef Math::DualQuaternion DualQuaternion; typedef Math::Quaternion Quaternion; typedef Math::Vector3 Vector3; -typedef Math::Vector4 Vector4; DualQuaternionTest::DualQuaternionTest() { addTests(&DualQuaternionTest::construct, diff --git a/src/Math/Test/QuaternionTest.cpp b/src/Math/Test/QuaternionTest.cpp index da7b16ed8..06f3e9ac8 100644 --- a/src/Math/Test/QuaternionTest.cpp +++ b/src/Math/Test/QuaternionTest.cpp @@ -212,7 +212,7 @@ void QuaternionTest::invertedNormalized() { Quaternion a = Quaternion({1.0f, 3.0f, -2.0f}, -4.0f); std::ostringstream o; - Corrade::Utility::Error::setOutput(&o); + Error::setOutput(&o); Quaternion notInverted = a.invertedNormalized(); CORRADE_COMPARE(notInverted.vector(), Vector3()); CORRADE_COMPARE(notInverted.scalar(), std::numeric_limits::quiet_NaN()); @@ -221,7 +221,7 @@ void QuaternionTest::invertedNormalized() { Quaternion aNormalized = a.normalized(); Quaternion inverted = aNormalized.invertedNormalized(); CORRADE_COMPARE(aNormalized*inverted, Quaternion()); - CORRADE_COMPARE(inverted*aNormalized.normalized(), Quaternion()); + CORRADE_COMPARE(inverted*aNormalized, Quaternion()); CORRADE_COMPARE(inverted, Quaternion({-1.0f, -3.0f, 2.0f}, -4.0f)/std::sqrt(30.0f)); }