All examples By author By category About

lwthatcher

Quadtree Search Filters

Performs a fixed-radius near neighbors search from a set of 2D points using d3-quadtree to speed up the search. Orange dots are points that were scanned but were found to be outside the radius. Red dots are scanned points found to be inside the radius.

This code is inspired and based off of armollica's block: Fixed-Radius Near Neighbors, however this code adds a slight optimization. Rather than calling quadtree.visit() it implements a varation taken from the quadtree.find() method's code written by Mike Bostock, which tries to look at the quads around the point first. This order of traversal allows it to explore fewer quads, and reduces the points outside of the bounding quads that are explored.

Note: The original example was based on this example that uses a similar method for identifying points within a rectangle.


forked from armollica's block: Fixed-Radius Near Neighbors

forked from lwthatcher's block: Fixed-Radius Near Neighbors

forked from lwthatcher's block: Fixed-Radius Near Neighbors II