summaryrefslogtreecommitdiff
path: root/src/code/sys_matrix.c
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-08-10 11:41:19 -0400
committerGitHub <noreply@github.com>2023-08-10 11:41:19 -0400
commit0d54e2ae4c473be47dba69ef6d560c49cc86d053 (patch)
tree7d4134acde42d6bfb10dad1260907b08694aefce /src/code/sys_matrix.c
parent04b31d912636eaea12a0b6f3d5e822605da68504 (diff)
`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
Diffstat (limited to 'src/code/sys_matrix.c')
-rw-r--r--src/code/sys_matrix.c22
1 files changed, 11 insertions, 11 deletions
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));
}
}
}