Here you can find the source of distance(float x1, float x2, float y1, float y2)
Parameter | Description |
---|---|
x1 | the x1 |
x2 | the x2 |
y1 | the y1 |
y2 | the y2 |
public static float distance(float x1, float x2, float y1, float y2)
//package com.java2s; public class Main { /**//from w w w.j a va 2 s . c om * Distance. * * @param x1 * the x1 * @param x2 * the x2 * @param y1 * the y1 * @param y2 * the y2 * @return the float */ public static float distance(float x1, float x2, float y1, float y2) { float dx = x1 - x2; float dy = y1 - y2; return (float) Math.sqrt((dx * dx) + (dy * dy)); } }