Millions of 3D points: How to find the 10 of them closest to a given point?

Million points is a small number. The most straightforward approach works here (code based on KDTree is slower (for querying only one point)). Brute-force approach (time ~1 second) #!/usr/bin/env python import numpy NDIM = 3 # number of dimensions # read points into array a = numpy.fromfile(‘million_3D_points.txt’, sep=’ ‘) a.shape = a.size / NDIM, NDIM … Read more