Closed mbostock closed 5 years ago
Okay, so the notebook’s implementation of delaunay.find was wrong. I have updated it to use delaunay._step and it is now correct. I didn’t investigate what was wrong with the notebook implementation.
Thanks!
Another visible issue in this notebook is that point 0 is degenerate (there are two butters in the dataset with the same x,y coordinates), so the first step in the notebook looks weird (because find is jumping arbitrarily to point 1). Not a problem per se but it makes the search path look wrong too, the first step being "backwards". Not sure if we should live with it or set start=1 instead of 0.
The other reason that I was surprised is that I was expecting it to follow the straightest line from the source to the target, but the algorithm doesn’t minimize the length of the line—it minimizes the number of hops (the topological distance).
The strategy is to jump blindly to a neighbor that is closer to the target — it does not guarantee that minimum. There are often shorter paths, both in total distance and number of hops.
See https://observablehq.com/d/8dc20942c4df82d2 for the three approaches .
Sometimes they diverge completely!
Cool demonstration! Thank you.
If the small red dot is the target (mouse location), is this the expected search path? It looks like it’s not actually choosing the points that are closest to the mouse while traversing, and I’m not sure if it’s an invalidation triangulation or something else weird. (This is a random 200-point sample of the delaunay.find notebook dataset.)