distance - nodef/extra-math GitHub Wiki

Calculate the distance between two points.

Alternatives: distance. Similar: distance.

function distance(xs, ys)
// xs: first point ([x, y, z, ...])
// ys: second point ([x, y, z, ...])
const xmath = require('extra-math');


xmath.distance([2, -6], [7, 3]);
// → 10.295630140987

xmath.distance([7, 4, 3], [17, 6, 2]);
// → 10.246950765959598

References