From 03f135e696fb7dd28a94c15f46d99d9b5b1e9057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 17 Sep 2012 13:45:35 +0200 Subject: [PATCH] Documentation clarification, assertion update. Don't yell at the user all the time. --- src/Math/Test/VectorTest.cpp | 2 +- src/Math/Vector.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index 7a3ef084b..5a93d3924 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -110,7 +110,7 @@ void VectorTest::angle() { Error::setOutput(&o); /* Both vectors must be normalized, otherwise NaN is returned */ CORRADE_COMPARE(Vector3::angle(Vector3(2.0f, 3.0f, 4.0f).normalized(), {1.0f, -2.0f, 3.0f}), numeric_limits::quiet_NaN()); - CORRADE_COMPARE(o.str(), "Math::Vector::angle(): vectors must be normalized!\n"); + CORRADE_COMPARE(o.str(), "Math::Vector::angle(): vectors must be normalized\n"); CORRADE_COMPARE(Vector3::angle({2.0f, 3.0f, 4.0f}, Vector3(1.0f, -2.0f, 3.0f).normalized()), numeric_limits::quiet_NaN()); CORRADE_COMPARE(Vector3::angle(Vector3(2.0f, 3.0f, 4.0f).normalized(), Vector3(1.0f, -2.0f, 3.0f).normalized()), rad(1.162514f)); diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 9d78a10ca..b3ec031a2 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -85,12 +85,12 @@ template class Vector: public RectangularMatrix<1, s, T> { * @f[ * \phi = \frac{a \cdot b}{|a| \cdot |b|} * @f] - * @attention If any of the parameters is not normalized (and - * assertions are enabled), returns NaN. + * @attention Assertion fails on non-normalized vectors and NaN is + * returned. */ inline static T angle(const Vector& a, const Vector& b) { CORRADE_ASSERT(MathTypeTraits::equals(a.dot(), T(1)) && MathTypeTraits::equals(b.dot(), T(1)), - "Math::Vector::angle(): vectors must be normalized!", std::numeric_limits::quiet_NaN()); + "Math::Vector::angle(): vectors must be normalized", std::numeric_limits::quiet_NaN()); return std::acos(dot(a, b)); }