git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@123 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
b642211025
commit
b4091a9c6f
|
@ -24,6 +24,7 @@
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "../TestSuite/Test.h"
|
#include "../TestSuite/Test.h"
|
||||||
#include "../../mathematics/Quaternion.h"
|
#include "../../mathematics/Quaternion.h"
|
||||||
|
#include "../../mathematics/constants.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -51,6 +52,8 @@ class QuaternionTest : public TestSuite::Test {
|
||||||
testGetConjugate();
|
testGetConjugate();
|
||||||
testGetInverse();
|
testGetInverse();
|
||||||
testScalarProduct();
|
testScalarProduct();
|
||||||
|
testgetRotationAngleAxis();
|
||||||
|
testSlerp();
|
||||||
testOperatorAddition();
|
testOperatorAddition();
|
||||||
testOperatorSubstraction();
|
testOperatorSubstraction();
|
||||||
testOperatorMultiplicationWithConstant();
|
testOperatorMultiplicationWithConstant();
|
||||||
|
@ -270,6 +273,25 @@ class QuaternionTest : public TestSuite::Test {
|
||||||
test_(result == 110.0);
|
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+()
|
// Test operator+()
|
||||||
void testOperatorAddition() {
|
void testOperatorAddition() {
|
||||||
Quaternion result = quaternion1 + quaternion2;
|
Quaternion result = quaternion1 + quaternion2;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user