Closed jens-ox closed 5 years ago
This is a bug.
Any progress on solving this bug?
If there were progress on solving this bug, you would see it here.
This seems to be working:
if (inedges[i] === -1) {
const l = points.length / 2;
return (i + 1 + (l - 1) * Math.random() | 0) % l;
}
It makes sure that from a coincident point i we jump to somewhere else than i, at random so it doesn't get stuck in an infinite loop.
@jens-ox let us know if you can confirm on your test case
I'm working with a set of lines that sometimes have coincident start points. I use d3-delaunay to find the nearest point to the cursor in order to highlight the line this point belongs to.
If it occurs that there is a point coincident to the first point of the first line,
inedges[0]
will be -1. Therefore,find(x, y, i = 0)
will return -1 independent ofx
andy
(because of how the_step
function is implemented) — butfind(x, y, i = 1)
will not return -1 (or maybe only fori = 2, 3,...
).Question:
i
and callingfind(x, y, i)
) or by d3-delaunay?