43 for (
int i = 0; i < n1; i++) {
44 vec2 s = vec2_sub(vs1[(i + 1) % n1], vs1[i]);
45 vec2 p = vec2_perpendicular(s);
46 norm2 pn = vec2_normalize(p);
50 for (
int i = 0; i < n2; i++) {
51 vec2 s = vec2_sub(vs2[(i + 1) % n2], vs2[i]);
52 vec2 p = vec2_perpendicular(s);
53 norm2 pn = vec2_normalize(p);
57 for (
sz i = 0; i < n1 + n2; i++) {
67 float depth = fmaxf(b.
x, a.
y) - fminf(b.
y, a.
x);
68 if (depth < minimal_depth) {
69 minimal_depth = depth;
70 *minimal = vec2_scale(axis, minimal_depth);
static bool sat_intersect(vec2 *vs1, sz n1, vec2 *vs2, sz n2, vec2 *minimal)
Definition sat.h:30