Java Distance Calculate dist(float x1, float y1, float x2, float y2)

Here you can find the source of dist(float x1, float y1, float x2, float y2)

Description

dist

License

Open Source License

Declaration

public static float dist(float x1, float y1, float x2, float y2) 

Method Source Code

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

public class Main {
    public static float dist(float x1, float y1, float x2, float y2) {
        final float x = (x2 - x1);
        final float y = (y2 - y1);
        return (float) Math.sqrt(x * x + y * y);
    }//from ww  w. j av  a  2s  .  c  om

    public static float dist(float x1, float y1, float z1, float x2, float y2, float z2) {
        final float x = (x2 - x1);
        final float y = (y2 - y1);
        final float z = (z2 - z1);
        return (float) Math.sqrt(x * x + y * y + z * z);
    }
}

Related

  1. dist(double lat1, double long1, double lat2, double long2)
  2. dist(double x1, double y1, double z1, double x2, double y2, double z2)
  3. dist(final double x0, final double y0, final double x1, final double y1)
  4. dist(float x1, float y1, float x2, float y2)
  5. dist(float x1, float y1, float x2, float y2)
  6. dist(float x1, float y1, float x2, float y2)
  7. dist(float x1, float y1, float x2, float y2, float xp, float yp)
  8. dist(float x1, float y1, float z1, float x2, float y2, float z2)
  9. dist(int i, int j, int width)