d3 / d3-delaunay

Compute the Voronoi diagram of a set of two-dimensional points.

Home Page:https://d3js.org/d3-delaunay

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Almost collinear points break the Voronoi

Fil opened this issue · comments

See demo at https://observablehq.com/d/b31c2945b6082f94

I'm creating these test points with a linear formula, so it's just rounding errors that make the points "almost collinear". But the consequence is that Delaunator finds triangles — which could OK except that d3-delaunay then fails when it computes the Voronoi (rounding errors in the circumcenters I suspect).

I'm not sure if this should be dealt with upstream or here. I managed to fix it by changing the test on minRadius from minRadius === Infinity to minRadius < 1e30, so that the second chance of #64 (jittering) kicks in. It might be the solution, but then it breaks the Delaunator tests.