From 0d54e2ae4c473be47dba69ef6d560c49cc86d053 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Thu, 10 Aug 2023 11:41:19 -0400 Subject: `libc64.a` identification (#45) * __osMalloc * aprintf.c * math64.c * qrand.c * sleep.c * sprintf.c * malloc.c * fixes * fp and math64 cleanup * RAD_TO_BINANG --- src/code/sys_matrix.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/code/sys_matrix.c') diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index b2af7fd..815677e 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -44,7 +44,7 @@ #include "z64math.h" #include "gfx.h" #include "m_skin_matrix.h" -#include "mathf.h" +#include "libc64/math64.h" #include "m_lib.h" // clang-format off @@ -1163,7 +1163,7 @@ void Matrix_to_rotate_new(MtxF* src, Vec3s* dest, s32 nonUniformScale) { temp = src->xz; temp *= temp; temp += SQ(src->zz); - dest->x = (Math_FAtan2F(-src->yz, sqrtf(temp))) * 10430.378f; + dest->x = RAD_TO_BINANG(fatan2(-src->yz, sqrtf(temp))); if ((dest->x == 0x4000) || (dest->x == -0x4000)) { // cos(x) = 0 if either of these is true, and we get gimbal locking @@ -1171,13 +1171,13 @@ void Matrix_to_rotate_new(MtxF* src, Vec3s* dest, s32 nonUniformScale) { // well-defined. dest->z = 0; - dest->y = Math_FAtan2F(-src->zx, src->xx) * 10430.378f; + dest->y = RAD_TO_BINANG(fatan2(-src->zx, src->xx)); } else { - dest->y = Math_FAtan2F(src->xz, src->zz) * 10430.378f; + dest->y = RAD_TO_BINANG(fatan2(src->xz, src->zz)); if (!nonUniformScale) { // assume the columns have the same normalisation - dest->z = Math_FAtan2F(src->yx, src->yy) * 10430.378f; + dest->z = RAD_TO_BINANG(fatan2(src->yx, src->yy)); } else { temp = src->xx; temp2 = src->zx; @@ -1203,7 +1203,7 @@ void Matrix_to_rotate_new(MtxF* src, Vec3s* dest, s32 nonUniformScale) { temp2 = temp3 / temp2; // yy in normalised column // for a rotation matrix, temp == yx and temp2 == yy which is the same as in the !nonUniformScale branch - dest->z = Math_FAtan2F(temp, temp2) * 10430.378f; + dest->z = RAD_TO_BINANG(fatan2(temp, temp2)); } } } @@ -1232,16 +1232,16 @@ void Matrix_to_rotate2_new(MtxF* src, Vec3s* dest, s32 nonUniformScale) { temp = src->xx; temp *= temp; temp += SQ(src->yx); - dest->y = Math_FAtan2F(-src->zx, sqrtf(temp)) * 10430.378f; + dest->y = RAD_TO_BINANG(fatan2(-src->zx, sqrtf(temp))); if ((dest->y == 0x4000) || (dest->y == -0x4000)) { dest->x = 0; - dest->z = Math_FAtan2F(-src->xy, src->yy) * 10430.378f; + dest->z = RAD_TO_BINANG(fatan2(-src->xy, src->yy)); } else { - dest->z = Math_FAtan2F(src->yx, src->xx) * 10430.378f; + dest->z = RAD_TO_BINANG(fatan2(src->yx, src->xx)); if (!nonUniformScale) { - dest->x = Math_FAtan2F(src->zy, src->zz) * 10430.378f; + dest->x = RAD_TO_BINANG(fatan2(src->zy, src->zz)); } else { temp = src->xy; temp2 = src->yy; @@ -1262,7 +1262,7 @@ void Matrix_to_rotate2_new(MtxF* src, Vec3s* dest, s32 nonUniformScale) { temp2 = sqrtf(temp2); temp2 = temp3 / temp2; - dest->x = Math_FAtan2F(temp, temp2) * 10430.378f; + dest->x = RAD_TO_BINANG(fatan2(temp, temp2)); } } } -- cgit v1.2.3