X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FPhysicsMath.h;h=fdf7d40c7fc2528a510657c658a45abe6c73711c;hb=87ff660bf58766ab705a749e72e04154ccf5a737;hp=70821b916988174368b96549ea27c7c5a16e237f;hpb=24004d6ab1e68faaf85ece11b566449997da5013;p=lugaru.git diff --git a/Source/PhysicsMath.h b/Source/PhysicsMath.h index 70821b9..fdf7d40 100644 --- a/Source/PhysicsMath.h +++ b/Source/PhysicsMath.h @@ -128,14 +128,18 @@ inline float Vector::Magnitude(void) inline void Vector::Normalize(void) { float m = (float) sqrt(x * x + y * y + z * z); - if (m <= tol) m = 1; + if (m <= tol) + m = 1; x /= m; y /= m; z /= m; - if (fabs(x) < tol) x = 0.0f; - if (fabs(y) < tol) y = 0.0f; - if (fabs(z) < tol) z = 0.0f; + if (fabs(x) < tol) + x = 0.0f; + if (fabs(y) < tol) + y = 0.0f; + if (fabs(z) < tol) + z = 0.0f; } inline void Vector::Reverse(void) @@ -324,7 +328,8 @@ inline Matrix3x3 Matrix3x3::Inverse(void) e31 * e12 * e23 - e31 * e22 * e13; - if (d == 0) d = 1; + if (d == 0) + d = 1; return Matrix3x3( (e22 * e33 - e23 * e32) / d, -(e12 * e33 - e13 * e32) / d,