From c15fd665db3d16e6466b4506f3e7b73d7d9a28dd Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 24 Feb 2023 21:12:33 -0800 Subject: [PATCH] Re-order variables in salInvertMatrix to match declaration order Former-commit-id: a86f8e434384e1cade92bae67c126a024e35dffc --- src/musyx/runtime/snd_math.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/musyx/runtime/snd_math.c b/src/musyx/runtime/snd_math.c index 4d96b9a8..bd083f1e 100644 --- a/src/musyx/runtime/snd_math.c +++ b/src/musyx/runtime/snd_math.c @@ -28,18 +28,18 @@ void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in) { float f; // r63 a = in->m[1][1] * in->m[2][2] - in->m[2][1] * in->m[1][2]; - c = -(in->m[1][0] * in->m[2][2] - in->m[2][0] * in->m[1][2]); - f = in->m[1][0] * in->m[2][1] - in->m[2][0] * in->m[1][1]; - b = 1.f / (in->m[0][0] * a + in->m[0][1] * c + in->m[0][2] * f); - out->m[0][0] = b * a; - out->m[1][0] = b * c; - out->m[2][0] = b * f; - out->m[0][1] = -b * (in->m[0][1] * in->m[2][2] - in->m[2][1] * in->m[0][2]); - out->m[1][1] = b * (in->m[0][0] * in->m[2][2] - in->m[2][0] * in->m[0][2]); - out->m[2][1] = -b * (in->m[0][0] * in->m[2][1] - in->m[2][0] * in->m[0][1]); - out->m[0][2] = b * (in->m[0][1] * in->m[1][2] - in->m[1][1] * in->m[0][2]); - out->m[1][2] = -b * (in->m[0][0] * in->m[1][2] - in->m[1][0] * in->m[0][2]); - out->m[2][2] = b * (in->m[0][0] * in->m[1][1] - in->m[1][0] * in->m[0][1]); + b = -(in->m[1][0] * in->m[2][2] - in->m[2][0] * in->m[1][2]); + c = in->m[1][0] * in->m[2][1] - in->m[2][0] * in->m[1][1]; + f = 1.f / (in->m[0][0] * a + in->m[0][1] * b + in->m[0][2] * c); + out->m[0][0] = f * a; + out->m[1][0] = f * b; + out->m[2][0] = f * c; + out->m[0][1] = -f * (in->m[0][1] * in->m[2][2] - in->m[2][1] * in->m[0][2]); + out->m[1][1] = f * (in->m[0][0] * in->m[2][2] - in->m[2][0] * in->m[0][2]); + out->m[2][1] = -f * (in->m[0][0] * in->m[2][1] - in->m[2][0] * in->m[0][1]); + out->m[0][2] = f * (in->m[0][1] * in->m[1][2] - in->m[1][1] * in->m[0][2]); + out->m[1][2] = -f * (in->m[0][0] * in->m[1][2] - in->m[1][0] * in->m[0][2]); + out->m[2][2] = f * (in->m[0][0] * in->m[1][1] - in->m[1][0] * in->m[0][1]); out->t[0] = (-in->t[0] * out->m[0][0] - in->t[1] * out->m[0][1]) - in->t[2] * out->m[0][2]; out->t[1] = (-in->t[0] * out->m[1][0] - in->t[1] * out->m[1][1]) - in->t[2] * out->m[1][2]; out->t[2] = (-in->t[0] * out->m[2][0] - in->t[1] * out->m[2][1]) - in->t[2] * out->m[2][2];