Skip to content

Instantly share code, notes, and snippets.

@krazyjakee
Created June 20, 2013 16:21
Show Gist options
  • Save krazyjakee/5824248 to your computer and use it in GitHub Desktop.
Save krazyjakee/5824248 to your computer and use it in GitHub Desktop.
Function to return the distance between 2 points
distance = ( p1, p2 ) ->
x = p2.x - p1.x
y = p2.y - p1.y
return Math.sqrt x*x + y*y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment