Changeset 2852


Ignore:
Timestamp:
Aug 26, 2013, 1:46:47 PM (6 years ago)
Author:
sam
Message:

math: fix an error in the quaternion code and update test suite.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lol/math/vector.h

    r2816 r2852  
    10071007inline T norm(Quat<T> const &val)
    10081008{
    1009     return sqlength(val);
     1009    return length(val);
    10101010}
    10111011
     
    10131013static inline Quat<T> re(Quat<T> const &val)
    10141014{
    1015     return ~val / norm(val);
     1015    return ~val / sqlength(val);
    10161016}
    10171017
  • trunk/test/unit/quat.cpp

    r2816 r2852  
    6868        quat a(2.f, -2.f, -8.f, 3.f);
    6969
    70         LOLUNIT_ASSERT_EQUAL(norm(a), 81.f);
     70        LOLUNIT_ASSERT_EQUAL(norm(a), 9.f);
    7171
    7272        quat b = a * ~a;
    73         quat c(norm(a), 0.f, 0.f, 0.f);
     73        quat c(norm(a) * norm(a), 0.f, 0.f, 0.f);
    7474
    7575        LOLUNIT_ASSERT_EQUAL(b, c);
    7676
    77         quat d(2.f, 3.f, -4.f, -1.f);
     77        quat d(2.f, 5.f, -4.f, -2.f);
    7878
    7979        LOLUNIT_ASSERT_EQUAL(norm(a * d), norm(a) * norm(d));
Note: See TracChangeset for help on using the changeset viewer.