Resolve issue #39, exp, squad and intermediate functions

This commit is contained in:
Christophe Riccio 2013-02-21 22:57:14 +01:00
parent e53c8b8529
commit 18a8efde62
2 changed files with 7 additions and 9 deletions

View File

@ -94,8 +94,7 @@ namespace glm
/// @see gtx_quaternion
template <typename valType>
detail::tquat<valType> exp(
detail::tquat<valType> const & q,
valType const & exponent);
detail::tquat<valType> const & q);
//! Returns a log of a quaternion.
///

View File

@ -40,7 +40,7 @@ namespace glm
detail::tquat<T> const & s2,
T const & h)
{
return mix(mix(q1, q2, h), mix(s1, s2, h), T(2) * h (T(1) - h));
return mix(mix(q1, q2, h), mix(s1, s2, h), T(2) * (T(1) - h) * h);
}
template <typename T>
@ -52,20 +52,19 @@ namespace glm
)
{
detail::tquat<T> invQuat = inverse(curr);
return ext((log(next + invQuat) + log(prev + invQuat)) / T(-4)) * curr;
return exp((log(next + invQuat) + log(prev + invQuat)) / T(-4)) * curr;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tquat<T> exp
(
detail::tquat<T> const & q,
T const & exponent
detail::tquat<T> const & q
)
{
detail::tvec3<T> u(q.x, q.y, q.z);
float a = glm::length(u);
detail::tvec3<T> v(u / a);
return detail::tquat<T>(cos(a), sin(a) * v);
float Angle = glm::length(u);
detail::tvec3<T> v(u / Angle);
return detail::tquat<T>(cos(Angle), sin(Angle) * v);
}
template <typename T>