Skip to content

[cute_c2] Inconsistencies between c2AABBtoPoly and c2AABBtoPolyManifold #404

@afk-mario

Description

@afk-mario

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions