KDTree.nearest_neighbor

KDTree.nearest_neighbor(point, exclude=None)

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

Parameters:
pointcompas.geometry.Point

The base point.

excludelist[compas_model.elements.Element], optional

A sequence of point identified by their label to exclude from the search.

Returns:
tuple[compas_model.elements.Element, float]

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