Skip to content

Instantly share code, notes, and snippets.

@jabranr

jabranr/distance.js

Last active Sep 17, 2017
Embed
What would you like to do?
(Math) Find distance between two known points
// Point a1
// Point a2
let dx = a2.x - a1.x;
let dy = a2.y - a1.y;
let distance = Math.sqrt(dx*dx + dy*dy);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment