KDTree.nearest_neighbors

KDTree.nearest_neighbors(point, number, distance_sort=False)[source]

Find the N nearest neighbors to a given point.

Parameters
  • point ([float, float, float] | Point) – XYZ coordinates of the base point.

  • number (int) – The number of nearest neighbors.

  • distance_sort (bool, optional) – Sort the nearest neighbors by distance to the base point.

Returns

list[[[float, float, float], int or str, float]] – A list of N nearest neighbors.