KDTree.nearest_neighbor

KDTree.nearest_neighbor(point, exclude=None)[source]

Find the nearest neighbor to a given point, excluding neighbors that have already been found.

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

  • exclude (sequence[int or str], optional) – A sequence of point identified by their label to exclude from the search.

Returns

[[float, float, float], int or str, float] – XYZ coordinates of the nearest neighbor. Label of the nearest neighbor. Distance to the base point.