diff --git a/sources/reactphysics3d/testing/testing_mathematics/QuaternionTest.h b/sources/reactphysics3d/testing/testing_mathematics/QuaternionTest.h index 8d94353f..1c619570 100644 --- a/sources/reactphysics3d/testing/testing_mathematics/QuaternionTest.h +++ b/sources/reactphysics3d/testing/testing_mathematics/QuaternionTest.h @@ -24,6 +24,7 @@ // Libraries #include "../TestSuite/Test.h" #include "../../mathematics/Quaternion.h" +#include "../../mathematics/constants.h" #include #include @@ -51,6 +52,8 @@ class QuaternionTest : public TestSuite::Test { testGetConjugate(); testGetInverse(); testScalarProduct(); + testgetRotationAngleAxis(); + testSlerp(); testOperatorAddition(); testOperatorSubstraction(); testOperatorMultiplicationWithConstant(); @@ -270,6 +273,25 @@ class QuaternionTest : public TestSuite::Test { test_(result == 110.0); } + // Test the getRotationAngleAxis() method + void testgetRotationAngleAxis() { + Quaternion quaternion(1.0, 2.0, 3.0, 0.0); + double invAxisLength = 1.0/sqrt(1.0 + 2.0*2.0 + 3.0*3.0); + double angle; + Vector3D axis; + + quaternion.getRotationAngleAxis(angle, axis); + test_(equal(angle, PI)); + test_(equal(axis.getX(), 1.0*invAxisLength)); + test_(equal(axis.getY(), 2.0*invAxisLength)); + test_(equal(axis.getZ(), 3.0*invAxisLength)); + } + + // Test the slerp() method + void testSlerp() { + // TODO : Test the Quaternion::slerp() method + } + // Test operator+() void testOperatorAddition() { Quaternion result = quaternion1 + quaternion2;