Add geom::angle(quaternion, quaternion)
This commit is contained in:
parent
4b711fc1c4
commit
e8076f528f
1 changed files with 6 additions and 1 deletions
|
|
@ -165,6 +165,12 @@ namespace psemek::geom
|
||||||
return {res[0], res[1], res[2]};
|
return {res[0], res[1], res[2]};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T angle(quaternion<T> const & q0, quaternion<T> const & q1)
|
||||||
|
{
|
||||||
|
return std::acos(std::min(T{1}, std::abs(dot(q0.coords, q1.coords))));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
quaternion<T> slerp(quaternion<T> const & q0, quaternion<T> const & q1, T const & t)
|
quaternion<T> slerp(quaternion<T> const & q0, quaternion<T> const & q1, T const & t)
|
||||||
{
|
{
|
||||||
|
|
@ -191,5 +197,4 @@ namespace psemek::geom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue