quaternion: use consistent order for naive impl
This commit is contained in:
parent
df27f5f89e
commit
b5b7ae3a9a
@ -184,14 +184,14 @@ util::rotate (vector3<T> v, quaternion<4,T> q)
|
|||||||
{
|
{
|
||||||
CHECK (is_normalised (v));
|
CHECK (is_normalised (v));
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
util::vector3<T> u { q.x, q.y, q.z };
|
// Naive:
|
||||||
return v + 2 * cross (u, cross (u, v) + q.w * v);
|
quaternion<4,T> p { 0, v.x, v.y, v.z };
|
||||||
#else
|
|
||||||
// Verbosely:
|
|
||||||
quaternionf p { 0, v.x, v.y, v.z };
|
|
||||||
auto p_ = q * p * conjugate (q);
|
auto p_ = q * p * conjugate (q);
|
||||||
return { p_.x, p_.y, p_.z };
|
return { p_.x, p_.y, p_.z };
|
||||||
|
#else
|
||||||
|
util::vector3<T> u { q.x, q.y, q.z };
|
||||||
|
return v + 2 * cross (u, cross (u, v) + q.w * v);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user