Skip to content

Instantly share code, notes, and snippets.

@natchiketa
Created August 22, 2012 03:52
Show Gist options
  • Save natchiketa/3422148 to your computer and use it in GitHub Desktop.
Save natchiketa/3422148 to your computer and use it in GitHub Desktop.
Distance between two coordinates
function distanceBetween( point1, point2 ) {
var xs = 0;
var ys = 0;
xs = point2.x - point1.x;
xs = xs * xs;
ys = point2.y - point1.y;
ys = ys * ys;
return Math.sqrt( xs + ys );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment