Here you can find the source of distancePointToPoint(final double x1, final double y1, final double x2, final double y2)
Parameter | Description |
---|---|
x1 | x coordinate of P1 |
y1 | y coordinate of P1 |
x2 | x coordinate of P2 |
y2 | y coordinate of P2 |
public static double distancePointToPoint(final double x1, final double y1, final double x2, final double y2)
//package com.java2s; public class Main { /**//from w ww.j av a2 s . c om * The distance between 2 points in the same plane. * @param x1 x coordinate of P1 * @param y1 y coordinate of P1 * @param x2 x coordinate of P2 * @param y2 y coordinate of P2 * @return distance */ public static double distancePointToPoint(final double x1, final double y1, final double x2, final double y2) { return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } }