Skip to content

Instantly share code, notes, and snippets.

@gvn
Created February 14, 2014 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gvn/9007204 to your computer and use it in GitHub Desktop.
Save gvn/9007204 to your computer and use it in GitHub Desktop.
Geometric Functions in Javascript

Geometric Functions in Javascript

Distance between 2 points

function distance(x1, y1, x2, y2) {
  return Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment