From 39613c0d87ace06e9648b3fb0d886f3c7758475c Mon Sep 17 00:00:00 2001 From: irei1as Date: Mon, 15 Feb 2016 18:43:56 +0100 Subject: [PATCH] Optimized You're right. If the normalized quaternions are in a variable or something for normal uses it's just a waste to force the change hidden inside again. --- Engine/source/math/mQuat.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Engine/source/math/mQuat.h b/Engine/source/math/mQuat.h index 628e298ba..10efb0619 100644 --- a/Engine/source/math/mQuat.h +++ b/Engine/source/math/mQuat.h @@ -227,12 +227,8 @@ inline F32 QuatF::dot( const QuatF &q ) const inline F32 QuatF::angleBetween( const QuatF & q ) { - // angle between two quaternions - QuatF base(x,y,z,w); - base.normalize(); - QuatF q_norm=q; - q_norm.normalize(); - return 2.0f*mAcos(base.dot(q_norm)); + // angle between two quaternions. + return mAcos(q.dot(*this)) * 2.0f; } #endif // _MQUAT_H_