grains.geometry.distance_matrix¶
-
grains.geometry.
distance_matrix
(points)[source]¶ A symmetric square matrix, containing the pairwise squared Euclidean distances among points.
- Parameters
points (ndarray) – 2D numpy array with 2 columns, each row corresponding to a point, and the two columns giving the Cartesian coordinates of the points.
- Returns
dm (ndarray) – Distance matrix.
See also
Examples
>>> points = np.array([[1, 1], [3, 0], [-1, -1]]) >>> distance_matrix(points) array([[ 0., 5., 8.], [ 5., 0., 17.], [ 8., 17., 0.]])