Search for nearest neighbors in D3

I performed a two-dimensional kd tree in Javascript ( check this on GitHub ) and I use it to find the closest neighbor next to D3 .

I found out that the quadtree implementation is in D3, but also found that the API documentation is sparse and the Google searches are not effective. I would rather use a well-traveled library than my own invented wheel when possible.

How to search for the nearest neighbor using D3 quadtree ? The closest neighbor I mean:

  • Fill the quadrant with two-dimensional points
  • Find the point containing the quadrants closest to the new point, which does not necessarily exist in the quadrant
+7
source share
1 answer

The purge demonstration does not find the nearest neighbor, but finds the quadrant points contained in this rectangle. (Try to clear the empty rectangle and not necessarily visit the nearest neighbors.)

I was looking for an example that effectively finds the closest neighbor in the quadrant at an arbitrary point - see http://bl.ocks.org/patricksurry/6478178

+4
source

All Articles