Use conjugate instead of inverse in quaternion rotation
This commit is contained in:
parent
f9e6a6e37e
commit
0a2cfda21f
1 changed files with 1 additions and 1 deletions
|
|
@ -163,7 +163,7 @@ namespace psemek::geom
|
||||||
template <typename T>
|
template <typename T>
|
||||||
vector<T, 3> rotate(quaternion<T> const & q, vector<T, 3> const & v)
|
vector<T, 3> rotate(quaternion<T> const & q, vector<T, 3> const & v)
|
||||||
{
|
{
|
||||||
auto res = q * quaternion<T>::vector(v) * inverse(q);
|
auto res = q * quaternion<T>::vector(v) * conjugate(q);
|
||||||
return {res[0], res[1], res[2]};
|
return {res[0], res[1], res[2]};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue