block by enjalot 778182a0cae1c2ff60186f7e7c1d350f

Quadtree Tree: Nearest Neighbors

Full Screen

This demonstrates finding the closest point to the mouse by searching a quadtree. As you descend into the quadtree, you track the closest point yet found and avoid searching cells that cannot contain closer points. Importantly, you must descend preferentially into closer cells so as to restrict the search more quickly.

Patrick Surry implemented a similar solution months earlier!

forked from mbostock‘s block: Quadtree Tree

forked from enjalot‘s block: Quadtree Tree