|
|
|
@ -34,7 +34,6 @@ |
|
|
|
#include "Magnum/Math/Dual.h" |
|
|
|
#include "Magnum/Math/Dual.h" |
|
|
|
#include "Magnum/Math/Matrix4.h" |
|
|
|
#include "Magnum/Math/Matrix4.h" |
|
|
|
#include "Magnum/Math/Quaternion.h" |
|
|
|
#include "Magnum/Math/Quaternion.h" |
|
|
|
#include "Magnum/Math/Functions.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Magnum { namespace Math { |
|
|
|
namespace Magnum { namespace Math { |
|
|
|
|
|
|
|
|
|
|
|
@ -70,9 +69,8 @@ template<class T> inline DualQuaternion<T> sclerp(const DualQuaternion<T>& norma |
|
|
|
|
|
|
|
|
|
|
|
/* Avoid division by zero */ |
|
|
|
/* Avoid division by zero */ |
|
|
|
const T cosHalfAngle = dotResult + normalizedA.real().scalar()*normalizedB.real().scalar(); |
|
|
|
const T cosHalfAngle = dotResult + normalizedA.real().scalar()*normalizedB.real().scalar(); |
|
|
|
if(std::abs(cosHalfAngle) >= T(1)) { |
|
|
|
if(std::abs(cosHalfAngle) >= T(1)) |
|
|
|
return DualQuaternion<T>{normalizedA.real(), Quaternion<T>{Math::lerp(normalizedA.dual().vector(), normalizedB.dual().vector(), t), T(0)}}; |
|
|
|
return {normalizedA.real(), {Implementation::lerp(normalizedA.dual().vector(), normalizedB.dual().vector(), t), T(0)}}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* l + εm = q_A^**q_B, multiplying with -1 ensures shortest path when dot < 0 */ |
|
|
|
/* l + εm = q_A^**q_B, multiplying with -1 ensures shortest path when dot < 0 */ |
|
|
|
const DualQuaternion<T> diff = normalizedA.quaternionConjugated()*(dotResult < T(0) ? -normalizedB : normalizedB); |
|
|
|
const DualQuaternion<T> diff = normalizedA.quaternionConjugated()*(dotResult < T(0) ? -normalizedB : normalizedB); |
|
|
|
|