ivanfratric / polypartition

Tiny Polygon Partitioning and Triangulation Library
MIT License
664 stars 118 forks source link

What's wrong with this input(square with inner square hole)? #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Square input poly with an interior square hole seems to be failing

input poly 1 
-1423 479
-1423 419
-1363 419
-1363 479

input poly 2 - marked as hole
-1403, 459
-1383, 459
-1383, 439
-1403, 439

Thanks

Original issue reported on code.google.com by jswig...@gmail.com on 10 May 2013 at 5:36

GoogleCodeExporter commented 9 years ago
Hi,
I cannot reproduce the problem, what methods did you use?

Original comment by ivan.fra...@gmail.com on 11 May 2013 at 11:47

GoogleCodeExporter commented 9 years ago
Sorry. I used

TPPLPartition partition;
partition.ConvexPartition_HM( &inputPolys, &convexPolys );

Original comment by jswig...@gmail.com on 13 May 2013 at 1:26

GoogleCodeExporter commented 9 years ago
Hm, that works for me. Here's a test code that I used:

    TPPLPartition pp;
    list<TPPLPoly> input;
    list<TPPLPoly> output;

    TPPLPoly p;
    p.Init(4);

    p[0].x = -1423; p[0].y = 479;
    p[1].x = -1423; p[1].y = 419;
    p[2].x = -1363; p[2].y = 419;
    p[3].x = -1363; p[3].y = 479;
    p.SetHole(false);
    input.push_back(p);

    p[0].x = -1403; p[0].y = 459;
    p[1].x = -1383; p[1].y = 459;
    p[2].x = -1383; p[2].y = 439;
    p[3].x = -1403; p[3].y = 439;
    p.SetHole(true);
    input.push_back(p);

    pp.ConvexPartition_HM(&input, &output);

Did you use the most recent version of the library? Did you make any changes to 
it? Or use different vertex ordering in your code?

Original comment by ivan.fra...@gmail.com on 13 May 2013 at 9:41

Attachments:

aaronfranke commented 3 years ago

Here is a test case text file (with 1500 added to the X values so that everything is positive): issue-6.txt

Here is the output when running this: issue-6.zip

Specifically, ConvexPartition_HM results in this, which looks fine to me:

conv_hm

I can't reproduce this bug, so it should probably be closed.