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 (list) – XYZ coordinates of the base point.

  • exclude (set, optional) – A set of points to exclude from the search. Defaults to an empty set.

Returns

list – XYZ coordinates of the nearest neighbor. Label of the nearest neighbor. Distance to the base point.