Java Distance Calculate distanceInf(double[] p1, double[] p2)

Here you can find the source of distanceInf(double[] p1, double[] p2)

Description

Distance inf.

License

Open Source License

Parameter

Parameter Description
p1 the p1
p2 the p2

Return

the double

Declaration

public static double distanceInf(double[] p1, double[] p2) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*  w ww . ja  v  a 2  s. c om*/
     * Distance inf.
     *
     * @param p1 the p1
     * @param p2 the p2
     * @return the double
     */
    public static double distanceInf(double[] p1, double[] p2) {
        double max = 0;
        for (int i = 0; i < p1.length; i++) {
            max = Math.max(max, Math.abs(p1[i] - p2[i]));
        }
        return max;
    }

    /**
     * Distance inf.
     *
     * @param p1 the p1
     * @param p2 the p2
     * @return the int
     */
    public static int distanceInf(int[] p1, int[] p2) {
        int max = 0;
        for (int i = 0; i < p1.length; i++) {
            max = Math.max(max, Math.abs(p1[i] - p2[i]));
        }
        return max;
    }
}

Related

  1. distanceFrom(double lat1, double long1, double lat2, double long2)
  2. DistanceFromLine(float cx, float cy, float ax, float ay, float bx, float by)
  3. distanceFromLineToPoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
  4. distanceFromZero(int x, int y)
  5. distanceHaversine(Double lat1, Double lon1, Double lat2, Double lon2, String param)
  6. distanceInMeters(double lat1, double lon1, double lat2, double lon2)
  7. distanceInMetersBetween(final double lat1, final double lng1, final double lat2, final double lng2)
  8. distanceInMilesBetween(float lat1, float lng1, float lat2, float lng2)
  9. distanceInMilesBetweenDouble(Float centerLat, Float centerLon, double lat, double lon)