distance

Calculates the distance between to vectors of the same length.

@safe
double
distance
(
T
char[] coords
E
)
(
Vector!(T, coords) vector1
,
Vector!(E, coords) vector2
)

Parameters

vector1 Vector!(T, coords)

the first vector

vector2 Vector!(E, coords)

the second vector

Return Value

Type: double

the distance between the two vectors (always higher or equals than 0)

Examples

assert(distance(vector(0, 0), vector(1, 0)) == 1);
assert(distance(vector(0, 0, 0) == vector(1, 1, 1)) == 3 ^^ .5); // 3 ^^ .5 is the squared root of 3

Meta