sort_points_xy

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

Sorts points of a pointcloud based on their distance from a given point, assuming all points lie in the XY plane.

Parameters:
point[float, float] or [float, float, float] | compas.geometry.Point

XY(Z) coordinates of a point.

cloudsequence[[float, float] or [float, float, float] | compas.geometry.Point]

A list of points represented by their XY(Z) coordinates.

Returns:
list[[float, [float, float, 0.0], int]]

A list containing the points of the cloud sorted by their squared distance to the base points. Each item in the list contains the squared distance to the base point, the XYZ coordinates of the point in the cloud in the XY plane, and the index of the point in the original cloud.

Notes

Check kdTree class for an optimized implementation (MR).

Examples

>>>