poly2tri icon indicating copy to clipboard operation
poly2tri copied to clipboard

Null pointer exception with a very simple polygon

Open mattbeghin opened this issue 5 years ago • 0 comments

I found this very simple polygon which generates a null pointer access violation. Any idea why ?

std::vector<p2t::Point*> polyline = {
    new p2t::Point(-0.611580879999999993401615938637,0.0104235565411950892311665484158),
    new p2t::Point(-0.611580879999999993401615938637,0.1483950316905975341796875),
    new p2t::Point(-0.578899596898762469621146919962,0.227294628589359948289683188705),
    new p2t::Point(-0.5,0.259975911690597527581303438637),
    new p2t::Point(0.5,0.259975911690597527581303438637),
    new p2t::Point(0.578899596898762469621146919962,0.227294628589359948289683188705),
    new p2t::Point(0.611580879999999993401615938637,0.1483950316905975341796875),
    new p2t::Point(0.611580879999999993401615938637,0.0104235565411950614755909327869),
    new p2t::Point(0.388419120000000006598384061363,0.0104235565411950892311665484158),
    new p2t::Point(0.388419120000000006598384061363,0.0368141516905975130224959457337),
    new p2t::Point(-0.388419120000000006598384061363,0.0368141516905975269002837535481),
    new p2t::Point(-0.388419120000000006598384061363,0.0104235565411950892311665484158)
};

p2t::CDT cdt(polyline);
cdt.Triangulate();
Screenshot 2019-12-05 at 13 20 21

You can check the WKT of the polygon (for instance here http://dev.openlayers.org/examples/vector-formats.html): POLYGON((-0.611580879999999993401615938637 0.0104235565411950892311665484158,-0.611580879999999993401615938637 0.1483950316905975341796875,-0.578899596898762469621146919962 0.227294628589359948289683188705,-0.5 0.259975911690597527581303438637,0.5 0.259975911690597527581303438637,0.578899596898762469621146919962 0.227294628589359948289683188705,0.611580879999999993401615938637 0.1483950316905975341796875,0.611580879999999993401615938637 0.0104235565411950614755909327869,0.388419120000000006598384061363 0.0104235565411950892311665484158,0.388419120000000006598384061363 0.0368141516905975130224959457337,-0.388419120000000006598384061363 0.0368141516905975269002837535481,-0.388419120000000006598384061363 0.0104235565411950892311665484158,-0.611580879999999993401615938637 0.0104235565411950892311665484158))

mattbeghin avatar Dec 05 '19 13:12 mattbeghin