Created
May 8, 2013 13:38
-
-
Save pjdietz/5540472 to your computer and use it in GitHub Desktop.
Calculate distance between two points.
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
/** Return the distance between two points */ | |
public static double distance(float x1, float y1, float x2, float y2) { | |
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment