From b5b7ae3a9a83d5ac5c694090b4cd53d702c1efbf Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 17 Oct 2016 18:58:45 +1100 Subject: [PATCH] quaternion: use consistent order for naive impl --- quaternion.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/quaternion.cpp b/quaternion.cpp index 38d12c73..a5268073 100644 --- a/quaternion.cpp +++ b/quaternion.cpp @@ -184,14 +184,14 @@ util::rotate (vector3 v, quaternion<4,T> q) { CHECK (is_normalised (v)); -#if 1 - util::vector3 u { q.x, q.y, q.z }; - return v + 2 * cross (u, cross (u, v) + q.w * v); -#else - // Verbosely: - quaternionf p { 0, v.x, v.y, v.z }; +#if 0 + // Naive: + quaternion<4,T> p { 0, v.x, v.y, v.z }; auto p_ = q * p * conjugate (q); return { p_.x, p_.y, p_.z }; +#else + util::vector3 u { q.x, q.y, q.z }; + return v + 2 * cross (u, cross (u, v) + q.w * v); #endif }