Fix NaN in quaternion slerp when slerping opposite quaternions
All checks were successful
Run tests / Run tests (push) Successful in 7m18s
All checks were successful
Run tests / Run tests (push) Successful in 7m18s
This commit is contained in:
parent
28126518d5
commit
6601824986
1 changed files with 4 additions and 2 deletions
|
|
@ -267,6 +267,8 @@ namespace psemek::math
|
||||||
// prevent division by zero
|
// prevent division by zero
|
||||||
if (d >= T{ 1})
|
if (d >= T{ 1})
|
||||||
return quaternion<T>{lerp(q0.coords, q1.coords, t)};
|
return quaternion<T>{lerp(q0.coords, q1.coords, t)};
|
||||||
|
if (d <= T{-1})
|
||||||
|
return quaternion<T>{lerp(q0.coords, -q1.coords, t)};
|
||||||
|
|
||||||
auto const omega = acos(abs(d));
|
auto const omega = acos(abs(d));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue