Java examples for 2D Graphics:Point
calculates the euclidean distance between points A and B
import static java.lang.Math.pow; import static java.lang.Math.sqrt; public class Main{ /**/*from ww w . ja v a 2s .co m*/ * calculates the euclidean distance between points A and B * @param pointA first point * @param pointB second point * @return distance between points */ public static double distance(final Point pointA, final Point pointB) { return sqrt(pow(pointA.getLatitude() - pointB.getLatitude(), 2) + pow(pointA.getLongitude() - pointB.getLongitude(), 2)); } }