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.