diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index c2b6e093..46f4fe0a 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -1006,13 +1006,13 @@ template struct Quat template inline T norm(Quat const &val) { - return sqlength(val); + return length(val); } template static inline Quat re(Quat const &val) { - return ~val / norm(val); + return ~val / sqlength(val); } template diff --git a/test/unit/quat.cpp b/test/unit/quat.cpp index 050b5f63..e6993561 100644 --- a/test/unit/quat.cpp +++ b/test/unit/quat.cpp @@ -67,14 +67,14 @@ LOLUNIT_FIXTURE(QuaternionTest) { quat a(2.f, -2.f, -8.f, 3.f); - LOLUNIT_ASSERT_EQUAL(norm(a), 81.f); + LOLUNIT_ASSERT_EQUAL(norm(a), 9.f); quat b = a * ~a; - quat c(norm(a), 0.f, 0.f, 0.f); + quat c(norm(a) * norm(a), 0.f, 0.f, 0.f); LOLUNIT_ASSERT_EQUAL(b, c); - quat d(2.f, 3.f, -4.f, -1.f); + quat d(2.f, 5.f, -4.f, -2.f); LOLUNIT_ASSERT_EQUAL(norm(a * d), norm(a) * norm(d)); }