Created
June 20, 2013 16:21
-
-
Save krazyjakee/5824248 to your computer and use it in GitHub Desktop.
Function to return the distance between 2 points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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