Delaunator-Python icon indicating copy to clipboard operation
Delaunator-Python copied to clipboard

Library doesn't work for random points

Open professorbradley opened this issue 2 years ago • 2 comments

I randomly distributed a bunch of points and the result was triangulation that was completely wrong, with various edges overlapping/criss-crossing each other (and to be clear, not connecting at any vertex), I suspect the following warnings might be relevant:

Delaunator.py:419: RuntimeWarning: overflow encountered in long_scalars dy * (ex * cp - bp * fx) +
Delaunator.py:420: RuntimeWarning: overflow encountered in long_scalars ap * (ex * fy - ey * fx) < 0 Delaunator.py:418: RuntimeWarning: overflow encountered in long_scalars return dx * (ey * cp - bp * fy) -\

The issue happens every time except for when I provide a set of trivial points, i.e 5 points with 4 at the corners and 1 in the middle or just 4 at the corners will triangulate perfectly but a bunch of randomly generated points just fails to triangulate at all.

So to clarify, the triangulation seems to be failing.

professorbradley avatar Nov 07 '22 20:11 professorbradley

I was able to change the datatype of the points array to suppress the warnings but my issue still persists.

professorbradley avatar Nov 07 '22 20:11 professorbradley

I suspect now my problem was the python library I was using to display the triangulation used a bad GL flag to display the result, i.e GL_TRIANGLE_STRIPES instead of GL_TRIANGLES resulting in erroneous edges being displayed; I haven't confirmed it yet but I'm pretty sure that's the issue.

professorbradley avatar Nov 09 '22 19:11 professorbradley