Skip to content

strange result for simple self intersecting case #80

@jonsykkel

Description

@jonsykkel

good evening
im geting strange result for a very simple case

TESStesselator *t;
float v[] = {
  1.000f, 4.000f,
  1.000f, 0.000f,
  0.000f, 0.000f,
  0.000f, 1.000f,
  4.000f, 1.000f,
  4.000f, 0.000f,
  3.000f, 0.000f,
};

t = tessNewTess(0);
if(!t) exit(1);
tessAddContour(t, 2, v, sizeof(float)*2, sizeof(v)/sizeof(float)/2);
if(!tessTesselate(t, TESS_WINDING_POSITIVE, TESS_BOUNDARY_CONTOURS, 0, 0, 0)) exit(1);
fprintf(stderr, "elt_n %u\n", tessGetElementCount(t));

v[1] += 0.001f;

t = tessNewTess(0);
if(!t) exit(1);
tessAddContour(t, 2, v, sizeof(float)*2, sizeof(v)/sizeof(float)/2);
if(!tessTesselate(t, TESS_WINDING_POSITIVE, TESS_BOUNDARY_CONTOURS, 0, 0, 0)) exit(1);
fprintf(stderr, "elt_n %u\n", tessGetElementCount(t));

outputs

elt_n 2
elt_n 1

the correct result is 1, can make it produce correct result if move some of the vertexes a tiny bit, or even by adding another contour completly outside of this one
very strange but im 2 dumb to figure out why it hapens

Image Image Image

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