Created
August 26, 2010 17:07
-
-
Save kinsteronline/551785 to your computer and use it in GitHub Desktop.
Distance w/Pythagorean
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
// I should have studied harder! | |
// http://en.wikipedia.org/wiki/Pythagorean_theorem | |
function distanceBetween(begin, end) { | |
var xs = end.x - begin.x, ys = end.y - begin.y; | |
return Math.sqrt(xs * xs + ys * ys); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment