K-d Tree Nearest-Neighbour Star Catalogue Search: Top View and Work Scaling (2D)
A top view of the same star box with the k-d tree splitting lines, the k nearest stars and the search circle, plus a plot of the work per query against catalogue size for the tree and brute force. Same algorithm and numerical checks as the 3D telescope scene.
Finding the stars nearest to a telescope pointing among thousands of catalogue entries is a classic spatial-search problem. A k-d tree splits the star box by planes and skips every branch the search sphere cannot reach, so it examines a few dozen stars instead of all of them. Choose the catalogue size, star distribution, number of neighbours and a range radius, and watch a Blender-built refractor follow a moving pointing while the tree and brute force race. Checked against brute force, the Poisson nearest-neighbour distance and median, the tree depth floor(log2 N)+1 and logarithmic scaling.
A top view of the same star box with the k-d tree splitting lines, the k nearest stars and the search circle, plus a plot of the work per query against catalogue size for the tree and brute force. Same algorithm and numerical checks as the 3D telescope scene.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install