From aa85aae1631dce81496ae4f57bb8ffebb044279e Mon Sep 17 00:00:00 2001 From: Adnan Munawar Date: Wed, 3 Feb 2021 17:20:25 -0500 Subject: [PATCH] Fixed implementation of normalize for afVector and * operator for afMatrix3d --- ambf_math/afMath.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ambf_math/afMath.h b/ambf_math/afMath.h index eeb47eb16..c5771ff58 100644 --- a/ambf_math/afMath.h +++ b/ambf_math/afMath.h @@ -109,7 +109,7 @@ class afVector3d{ void normalize(){ double magInv = 1.0 / getNorm(); - (*this)(0) += magInv; + (*this)(0) *= magInv; (*this)(1) *= magInv; (*this)(2) *= magInv; } @@ -233,9 +233,9 @@ class afMatrix3d{ afVector3d operator *(afVector3d vIn){ afVector3d vOut; - vOut(0) = m_data[0][0] * vIn(0) + m_data[0][1] * vIn(0) + m_data[0][2] * vOut(0); - vOut(1) = m_data[1][0] * vIn(1) + m_data[1][1] * vIn(1) + m_data[1][2] * vOut(1); - vOut(2) = m_data[2][0] * vIn(2) + m_data[2][1] * vIn(2) + m_data[2][2] * vOut(2); + vOut(0) = m_data[0][0] * vIn(0) + m_data[0][1] * vIn(1) + m_data[0][2] * vIn(2); + vOut(1) = m_data[1][0] * vIn(0) + m_data[1][1] * vIn(1) + m_data[1][2] * vIn(2); + vOut(2) = m_data[2][0] * vIn(0) + m_data[2][1] * vIn(1) + m_data[2][2] * vIn(2); return vOut; }