From a9a18b4f32263ff48fa014efa6aeabe5f52e63b2 Mon Sep 17 00:00:00 2001 From: eihrul Date: Tue, 6 Oct 2009 12:11:24 +0000 Subject: [PATCH] use cached matrix elements for calculating determinant git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9315 d7cf8633-e32d-0410-b094-e92efae38249 --- matrixlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrixlib.c b/matrixlib.c index 38c41817..9ed67b59 100644 --- a/matrixlib.c +++ b/matrixlib.c @@ -181,7 +181,7 @@ int Matrix4x4_Invert_Full (matrix4x4_t *out, const matrix4x4_t *in1) out->m[3][3] = (m00*(m11*m22 - m12*m21) - m10*(m01*m22 - m02*m21) + m20*(m01*m12 - m02*m11)); // calculate the determinant (as inverse == 1/det * adjoint, adjoint * m == identity * det, so this calculates the det) - det = in1->m[0][0]*out->m[0][0] + in1->m[1][0]*out->m[0][1] + in1->m[2][0]*out->m[0][2] + in1->m[3][0]*out->m[0][3]; + det = m00*out->m[0][0] + m10*out->m[0][1] + m20*out->m[0][2] + m30*out->m[0][3]; if (det == 0.0f) return 0; -- 2.39.2