Created
September 16, 2015 08:34
-
-
Save reportbase/58717d4f2edf342d59c0 to your computer and use it in GitHub Desktop.
point distance
This file contains hidden or 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
function point(x, y) | |
{ | |
this.x = x; | |
this.y = y; | |
} | |
function distance(a, b) | |
{ | |
var x = a.x - b.x; | |
var y = a.y - b.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