Skip to content

Wrong output of specific polygon #37

@september1st

Description

@september1st

Hi Mikko
I'm a C++ developer from China. Thank you for contributing this great library.
However, I find something wrong when I draw a rectangle with a hole which has 2 coincident edges. The version is v1.0.2.
As shown below, When I draw a rectangle(0->1->2->3) with a hole(4->5->6->7). Line 56 coincides with Line 32, and Line 01 coincides with Line 47.
Forgive me that I can't attach my source code for some reason. My code like this:

tessAddContour(tess, 2, polyPoints[0], 2 * sizeof(float), 4);
tessAddContour(tess, 2, polyPoints[1], 2 * sizeof(float), 4);

tessTesselate(tess, TessWindingRule::TESS_WINDING_ODD, TessElementType::TESS_POLYGONS, 3, 2, 0);

triangleVerts = tessGetVertices(tess);
elemCount = tessGetElementCount(tess);
triangleElems = tessGetElements(tess);

After that, I find that elemCount is 3, and I calculate the output triangles by triangleVerts and triangleElems in TESS_POLYGONS way. I get only 3 triangles:
(0,5,3)(5,0,4)(2,7,1). After renderring, my output picture shown like this below. One triangle (2,7,6) is missing.
image
I'm confused and I've done many experiments. I find that this commit will cause my problem. I am sure about this. I would be very greatful if you can point the connection between this "<=" and my problem, Or maybe my code is wrong?

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