Add kdtree knn query implementation.