grains.geometry.squared_distance¶
-
grains.geometry.
squared_distance
(x, y)[source]¶ Squared Euclidean distance between two points.
For points \(x(x_1, ..., x_n)\) and \(y(y_1, ... y_n)\) the following metric is computed
\[\sum\limits_{i=1}^n (x_i - y_i)^2\]- Parameters
x, y (ndarray) – 1D numpy array, containing the coordinates of the two points.
- Returns
float – Squared Euclidean distance.
See also
Examples
>>> squared_distance(np.array([0, 0, 0]), np.array([1, 1, 1])) 3.0