closest_point_in_cloud_xy

compas.geometry.closest_point_in_cloud_xy(point, cloud)[source]

Calculates the closest point in a list of points in the XY-plane.

Parameters
  • point ([float, float] or [float, float, float] | compas.geometry.Point) – XY(Z) coordinates of a the base point.

  • cloud (sequence[[float, float] or [float, float, float] | compas.geometry.Point]) – A list of points forming the cloud, with each point represented by its XY(Z) coordinates.

Returns

  • float – The distance to the closest point.

  • [float, float, 0.0] – The XYZ coordinates of the closest point in the XY plane.

  • int – The index of the closest point in the cloud.

Notes

Check kdTree class for an optimized implementation (MR).