Here you can find the source of distance(double x1, double y1, double x2, double y2)
Parameter | Description |
---|---|
x1 | a parameter |
y1 | a parameter |
x2 | a parameter |
y2 | a parameter |
public static double distance(double x1, double y1, double x2, double y2)
//package com.java2s; /**//from w w w.j a va 2s .c o m * <p> * Useful math functions. :) * </p> * <p> * <span class="BSDLicense"> This software is distributed under the <a * href="http://hci.stanford.edu/research/copyright.txt">BSD License</a>. </span> * </p> * * @author <a href="http://graphics.stanford.edu/~ronyeh">Ron B Yeh</a> (ronyeh(AT)cs.stanford.edu) */ public class Main { /** * @param x1 * @param y1 * @param x2 * @param y2 * @return */ public static double distance(double x1, double y1, double x2, double y2) { return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)); } }