From b4091a9c6f78e76f49cb8a19e480fd6ecf55922f Mon Sep 17 00:00:00 2001 From: "chappuis.daniel" Date: Fri, 10 Apr 2009 15:35:52 +0000 Subject: [PATCH] git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@123 92aac97c-a6ce-11dd-a772-7fcde58d38e6 --- .../testing_mathematics/QuaternionTest.h | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) 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;