mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 04:31:47 +00:00
Resolve issue #39, exp, squad and intermediate functions
This commit is contained in:
parent
e53c8b8529
commit
18a8efde62
@ -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.
|
||||
///
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user