summaryrefslogtreecommitdiff
path: root/libphysics/aabb.c
diff options
context:
space:
mode:
authoresquizo <esquizo+noreply@esquizo.net>2026-06-03 16:10:57 -0300
committeresquizo <esquizo+noreply@esquizo.net>2026-06-03 16:10:57 -0300
commit83b1c06b186614d1bf2171feb46754bd8a8e6dfa (patch)
treeb8da3f436cba5736d481690935135fe5c6b3badc /libphysics/aabb.c
parent005f0a3185eb8085f6e0de11e3cfd0a3d9167719 (diff)
libphysics removido (ideia jogada fora)
Diffstat (limited to 'libphysics/aabb.c')
-rw-r--r--libphysics/aabb.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/libphysics/aabb.c b/libphysics/aabb.c
deleted file mode 100644
index 59648c8..0000000
--- a/libphysics/aabb.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <vecmath.h>
-#include <physics.h>
-#include <stdlib.h>
-
-#include "dat.h"
-
-static void mink(Body *a, Body *b, vec2 min, vec2 max);
-
-int
-phxaabbcheck(Body *a, Body *b)
-{
- vec2 min, max;
- mink(a, b, min, max);
- return min[0] < 0 && max[0] > 0 && min[1] < 0 && max[1] > 0;
-}
-
-void
-phxaabbresolv(Body *a, Body *b, vec2 p, vec2 n)
-{
- vec2 min, max;
- mink(a, b, min, max);
-
- float hx = fabsf(min[0]) < fabsf(max[0]) ? fabsf(min[0]) : fabsf(max[0]);
- float hy = fabsf(min[1]) < fabsf(max[1]) ? fabsf(min[1]) : fabsf(max[1]);
-
- if(hx < hy) {
- n[1] = 0.0;
- n[0] = (fabsf(min[0]) < fabsf(max[0]) ? -1.0 : 1.0);
- } else {
- n[0] = 0;
- n[1] = (fabsf(min[1]) < fabsf(max[1]) ? -1.0 : 1.0);
- }
-
- vec2_mul(p, (vec2){ hx, hy }, n);
-}
-
-
-void
-mink(Body *a, Body *b, vec2 min, vec2 max)
-{
- float p[2], s[2];
-
- for(int i = 0; i < 2; i++) {
- s[i] = a->size[i] + b->size[i];
- p[i] = a->pos[i] - b->pos[i];
- }
-
- for(int i = 0; i < 2; i++) {
- min[i] = p[i] - s[i];
- max[i] = p[i] + s[i];
- }
-}