Java Distance Calculate calcDistance(int ax, int ay, int bx, int by)

Here you can find the source of calcDistance(int ax, int ay, int bx, int by)

Description

calc Distance

License

Open Source License

Parameter

Parameter Description
ax a parameter
ay a parameter
bx a parameter
by a parameter

Declaration

public static int calcDistance(int ax, int ay, int bx, int by) 

Method Source Code

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

public class Main {
    /**/*from   w ww.ja v  a2 s.c  o m*/
     * @param ax
     * @param ay
     * @param bx
     * @param by
     * @return
     */
    public static int calcDistance(int ax, int ay, int bx, int by) {
        int sum1 = bx - ax;
        int sum2 = by - ay;
        double square = (Math.pow(sum1, 2) + Math.pow(sum2, 2));
        int distance = (int) Math.sqrt(square);
        return distance;
    }
}

Related

  1. CalcDistance(double lat1, double lon1, double lat2, double lon2)
  2. calcDistance(double lon1, double lat1, double lon2, double lat2)
  3. calcDistance(final int coordinate1, final int coordinate2)
  4. calcDistance(int x1, int y1, int x2, int y2)
  5. calcDistanceBetweenCoords(double startLat, double startLon, double endLat, double endLon)
  6. calcDistanceHubery(double lat1, double lng1, double lat2, double lng2, int type)
  7. calcDistanceIfAccel(double startVelocity, double accel, double targetVelocity, double duration)