Calculate distance between two points - Node.js Geometry

Node.js examples for Geometry:Distance

Description

Calculate distance between two points

Demo Code

function distance(a, b) {
    var dx = Math.abs(a.x - b.x);
    var dy = Math.abs(a.y - b.y);
    return Math.sqrt(dx * dx + dy * dy);
}

Related Tutorials