summaryrefslogtreecommitdiff
path: root/maths.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-07-13 23:38:42 +1000
committerquou <quou@disroot.org>2024-07-13 23:38:42 +1000
commitd848586c8aa8ff7d12601ba75f2a2bd9610f3500 (patch)
tree6693e1338c71ef99cd7df49e74c852cf11e9ba35 /maths.h
parent18b4f4c51aceb21f6ea8cad48d7582f40605e994 (diff)
Add some maths functions
Diffstat (limited to 'maths.h')
-rw-r--r--maths.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/maths.h b/maths.h
index e63878c..6d33c6f 100644
--- a/maths.h
+++ b/maths.h
@@ -4,6 +4,7 @@
#define mini(a_, b_) ((a_) < (b_) ? (a_) : (b_))
#define maxi(a_, b_) ((a_) > (b_) ? (a_) : (b_))
#define clamp(v_, min_, max_) (maxi(min_, mini(max_, v_)))
+#define absolute(v_) ((v_) < 0? -(v_): (v_))
#define fbits 9
#define f1 (1 << fbits)
@@ -19,6 +20,8 @@ extern int sqrt_table[sqrt_table_count];
void init_maths(void);
+int fpow(int a, int p);
+
int* mtx_iden(int* m);
int* mtx_cpy(int* d, const int* s);
int* mtx_mul(int* d, const int* a, const int* b);
@@ -36,6 +39,8 @@ int* mtx_rot_y(int* d, int a);
int* mtx_rot_z(int* d, int a);
int* mtx_apply(const int* m, int* v);
int* vec_cpy(int* d, const int* s, int c);
+int* vec_ref(int* d, const int* i, const int* n, int c);
+int vec_dot(const int* a, const int* b, int d);
void persp(int* v, int asp);
void ndc2clip(int* c, int* p);