[cute_c2] Inconsistencies between c2AABBtoPoly and c2AABBtoPolyManifold
c2AABBtoPoly sometimes return false when c2AABBtoPolyManifold does have contact points.
#define CUTE_C2_IMPLEMENTATION
#include "cute_c2.h"
#include <assert.h>
int main(int argc, char *argv[]) {
c2Manifold m;
c2v a, b;
c2AABB bb = {.min.x = 320, .min.y = 320, .max.x = 352, .max.y = 352};
c2Poly pol = {
.count = 4,
.verts =
{
{.x = 334, .y = 320},
{.x = 344, .y = 332},
{.x = 364, .y = 332},
{.x = 364, .y = 320},
},
};
c2MakePoly(&pol);
int res = c2AABBtoPoly(bb, &pol, 0);
c2AABBtoPolyManifold(bb, &pol, 0, &m);
if (res) {
assert(m.count > 0);
} else {
assert(m.count == 0);
}
}
c2bug: main.c:28: main: Assertion `m.count == 0' failed.
Hey there, the two functions you refer to use different algorithms, so they will have different numeric results. It's totally acceptable to have certain cases give different results. In this case, it looks like you've tried to make the test so the two boxes line up on exactly the same number, right? That might just be a difference internally on some < instead of <=, which we can maybe fix.
I'm just writing down context later in case I (or someone else) wants to try and look into this. Right now though this is a bit low priority for me to dive into.