mirror of
https://github.com/g-truc/glm.git
synced 2025-04-07 22:40:17 +00:00
Fixed quat slerp using mix function when cosTheta close to 1
This commit is contained in:
parent
0b41846700
commit
560b474008
2 changed files with 15 additions and 14 deletions
|
@ -451,20 +451,20 @@ namespace detail
|
|||
T const & a
|
||||
)
|
||||
{
|
||||
T cosTheta = dot(x, y);
|
||||
if(cosTheta <= epsilon<T>())
|
||||
{
|
||||
return detail::tquat<T>(
|
||||
mix(x.x, y.x, a),
|
||||
mix(x.y, y.y, a),
|
||||
mix(x.z, y.z, a),
|
||||
mix(x.w, y.w, a));
|
||||
}
|
||||
else
|
||||
{
|
||||
T angle = acos(cosTheta);
|
||||
return (glm::sin((T(1) - a) * angle) * x + glm::sin(a * angle) * y) / glm::sin(angle);
|
||||
}
|
||||
T cosTheta = dot(x, y);
|
||||
if(glm::abs(cosTheta - T(1)) <= epsilon<T>())
|
||||
{
|
||||
return detail::tquat<T>(
|
||||
mix(x.x, y.x, a),
|
||||
mix(x.y, y.y, a),
|
||||
mix(x.z, y.z, a),
|
||||
mix(x.w, y.w, a));
|
||||
}
|
||||
else
|
||||
{
|
||||
T angle = acos(cosTheta);
|
||||
return (glm::sin((T(1) - a) * angle) * x + glm::sin(a * angle) * y) / glm::sin(angle);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -44,6 +44,7 @@ GLM 0.9.4.1: 2012-12-17
|
|||
- Fixed interaction between quaternion and euler angles.
|
||||
- Fixed GTC_constants build
|
||||
- Fixed GTX_multiple
|
||||
- Fixed quat slerp using mix function when cosTheta close to 1
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.0: 2012-11-18
|
||||
|
|
Loading…
Add table
Reference in a new issue