coords.Coords.distance_to_points#

Coords.distance_to_points(other_points, return_indices=False)#

Return the distance from each point in this Coords object to the nearest point in another set.

Parameters#

other_pointsfloat array_like with shape (N,3)

Coordinates of the set of points to compute distances to.

return_indicesbool, optional

If True, also return the index of the nearest point in other_points for each point in this Coords object. Default is False.

Returns#

distancesfloat array

Array with shape points_shape() holding the distance of each point in this Coords to the nearest point in other_points.

indicesint array, optional

Only returned if return_indices is True. Array of indices indicating the closest point in other_points for each point in this Coords object.

Examples#

>>> X = Coords([[0.,0.,0.],[2.,0.,0.],[1.,3.,0.]])
>>> Y = [[0.,0.,0.],[1.,1.,0.]]
>>> X.distance_to_points(Y)
array([0.    , 1.4142, 2.    ])
>>> X.distance_to_points(Y, return_indices=True)
(array([0.    , 1.4142, 2.    ]), array([0, 1, 1]))