colour.algebra.manhattan_distance#

colour.algebra.manhattan_distance(a: ArrayLike, b: ArrayLike) NDArrayFloat[source]#

Compute the Manhattan (or City-Block) distance between point array \(a\) and point array \(b\).

For a two-dimensional space, the metric is defined as:

\(M_D = |x_a - x_b| + |y_a - y_b|\)

Parameters:
Returns:

Manhattan distance.

Return type:

np.float or numpy.ndarray

Examples

>>> a = np.array([100.00000000, 21.57210357, 272.22819350])
>>> b = np.array([100.00000000, 426.67945353, 72.39590835])
>>> manhattan_distance(a, b)
604.9396351...