Skip to content

Instantly share code, notes, and snippets.

@jabranr
Last active September 17, 2017 09:05
Show Gist options
  • Save jabranr/fe5f4ef5bbfdc7597df126586c709251 to your computer and use it in GitHub Desktop.
Save jabranr/fe5f4ef5bbfdc7597df126586c709251 to your computer and use it in GitHub Desktop.
(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