I have a 3D pointcloud and I\'d like to efficiently query all points within distance d from an arbitrary point p (which is not necessarily part of the stored pointcloud)
VTK can help:
void vtkAbstractPointLocator::FindPointsWithinRadius ( double R, double x, double y, double z, vtkIdList * result )
Subclasses of vtkAbstractPointLocator contain different data structures for search acceleration: regular buckets, kd-trees, and octrees.