d3 / d3-voronoi

Compute the Voronoi diagram of a set of two-dimensional points.
Other
249 stars 60 forks source link

.find() throws exception when data contains two elements on the same same position #21

Closed wereHamster closed 7 years ago

wereHamster commented 7 years ago

d3-voronoi v1.1.0

const v = d3.voronoi()([[0,0], [0,0]]);
v.find(0, 0); // <- Uncaught TypeError: Cannot read property 'site' of undefined(…)

If you inspect v.cells you'll see that the first item in the array is undefined instead of a cell object.

v.triangles() also throws an exception, although a different message. And v.triangles() returns an array where the first element is undefined.

The documentation doesn't mention exceptions at all, which is why I didn't expect them.