summaryrefslogtreecommitdiff
path: root/src/code/sys_math.c
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2022-10-15 23:29:36 +0200
committerGitHub <noreply@github.com>2022-10-15 17:29:36 -0400
commit0283493db8e968be67d9e591ec4719fe9d0477f0 (patch)
tree90dbdd87c1942b16522b4c336a3966afd66fb8d9 /src/code/sys_math.c
parent0b38f6e6785e52685a80463df3c7c85db878e8ea (diff)
Lightweight trigonometry doc (#1356)
* Doc units of trig functions * "Very simple" yet I made a mistake * sins returns in [-0x7FFF,0x7FFF] as the [-1,1] range * Also `sys_math_atan.c` * Remove `@param`s without descriptions * Add note on Math_Atan2S/F arguments being unlike atan2 * "from (1,0) to (x,y)" -> "from vector ..." * arg names -> `angle` * Improve `@return` comment on atans
Diffstat (limited to 'src/code/sys_math.c')
-rw-r--r--src/code/sys_math.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/code/sys_math.c b/src/code/sys_math.c
index 0a85d5cf6..f19719bb9 100644
--- a/src/code/sys_math.c
+++ b/src/code/sys_math.c
@@ -38,10 +38,18 @@ f32 Math_PowF(f32 base, s32 exp) {
return ret;
}
+/**
+ * @param angle radians
+ * @return sin(angle)
+ */
f32 Math_SinF(f32 angle) {
return sins((s16)(angle * (0x7FFF / M_PI))) * SHT_MINV;
}
+/**
+ * @param angle radians
+ * @return cos(angle)
+ */
f32 Math_CosF(f32 angle) {
return coss((s16)(angle * (0x7FFF / M_PI))) * SHT_MINV;
}