sort_points

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

Sorts points of a pointcloud based on their distance from a given point.

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

The XYZ coordinates of the base point.

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

A sequence locations in three-dimensional space.

Returns:
list[[float, [float, float, float], 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, and the index of the point in the original cloud.

Notes

Check kdTree class for an optimized implementation (MR).

Examples

>>>