Java Distance Calculate distanceTo(final int x, final int y, final int thatx, final int thaty)

Here you can find the source of distanceTo(final int x, final int y, final int thatx, final int thaty)

Description

Returns the Euclidean distance between this point and that point.

License

Open Source License

Return

the Euclidean distance between this point and that point

Declaration

public static float distanceTo(final int x, final int y, final int thatx, final int thaty) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* ww w. java2s  .c  o m*/
     * Returns the Euclidean distance between this point and that point.
     *
     * @return the Euclidean distance between this point and that point
     */
    public static float distanceTo(final int x, final int y, final int thatx, final int thaty) {
        final int dx = x - thatx;
        final int dy = y - thaty;
        return (float) Math.sqrt(dx * dx + dy * dy);
    }
}

Related

  1. distanceSquaredPointToLine(float px, float py, float x1, float y1, float x2, float y2)
  2. distanceSquaredPointToPoint(float x1, float y1, float x2, float y2)
  3. distanceSqured(int x, int y, int z, int x1, int y1, int z1)
  4. distanceSV(double[] sv1, double[] sv2)
  5. distanceTo(double latitudeGiven, double longitudeGiven, double latitudeTaken, double longitudeTaken)
  6. distanceToAncestor(Class entity, Class ancestor)
  7. distanceToClass(Class theClass, Class theAncestor)
  8. distanceToInterface(Class theClass, Class theInterface)
  9. distanceToPoint(float x1, float y1, float x2, float y2)