git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@90 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
20f5361624
commit
da3b7a7ec2
|
@ -19,6 +19,7 @@
|
|||
|
||||
// Libraries
|
||||
#include "Quaternion.h"
|
||||
#include <cassert>
|
||||
|
||||
// Namespaces
|
||||
using namespace reactphysics3d;
|
||||
|
@ -52,4 +53,13 @@ Quaternion::~Quaternion() {
|
|||
|
||||
}
|
||||
|
||||
// --- Others functions --- //
|
||||
|
||||
// Compute the spherical linear interpolation between two quaternions.
|
||||
// The t argument has to be such that 0 <= t <= 1
|
||||
Quaternion slerp(const Quaternion& quaternion1, const Quaternion& quaternion2, double t) {
|
||||
//TODO : Implement this method
|
||||
assert(t >= 0 && t <= 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ class Quaternion
|
|||
Quaternion getUnit() const throw (MathematicsException); // Return the unit quaternion
|
||||
Quaternion getConjugate() const; // Return the conjugate quaternion
|
||||
Quaternion getInverse() const throw (MathematicsException); // Return the inverse of the quaternion
|
||||
double scalarProduct(const Quaternion& quaternion); // Scalar product between two quaternions
|
||||
|
||||
// --- Overloaded operators --- //
|
||||
Quaternion operator+(const Quaternion& quaternion) const; // Overloaded operator for the addition
|
||||
|
@ -71,6 +72,7 @@ class Quaternion
|
|||
bool operator==(const Quaternion& quaternion) const; // Overloaded operator for equality condition
|
||||
};
|
||||
|
||||
// --- Inline functions --- //
|
||||
|
||||
// Get the value x (inline)
|
||||
inline double Quaternion::getX() const {
|
||||
|
@ -161,6 +163,12 @@ inline Quaternion Quaternion::getInverse() const throw(MathematicsException) {
|
|||
}
|
||||
}
|
||||
|
||||
// Scalar product between two quaternions
|
||||
// TODO : Test for this method
|
||||
inline double Quaternion::scalarProduct(const Quaternion& quaternion) {
|
||||
return (x*quaternion.x + y*quaternion.y + z*quaternion.z + w*quaternion.w);
|
||||
}
|
||||
|
||||
// Overloaded operator for the addition of two quaternions
|
||||
inline Quaternion Quaternion::operator+(const Quaternion& quaternion) const {
|
||||
// Return the result quaternion
|
||||
|
@ -204,6 +212,11 @@ inline bool Quaternion::operator==(const Quaternion& quaternion) const {
|
|||
return (x == quaternion.x && y == quaternion.y && z == quaternion.z && w == quaternion.w);
|
||||
}
|
||||
|
||||
// --- Others functions --- //
|
||||
|
||||
// Compute the spherical linear interpolation between two quaternions
|
||||
Quaternion slerp(const Quaternion& quaternion1, const Quaternion& quaternion2, double t);
|
||||
|
||||
} // End of the ReactPhysics3D namespace
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user