Compute the Euclidean distance between p1 and p2.
@param p1 first point
@param p2 second point
@return Euclidean distance
778778
private static double distance(double[] p1, double[] p2) {
		switch (p1.length) {
			case 2: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]));
			case 3: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]) + (p1[2] - p2[2]) * (p1[2] - p2[2]));
			default: {
				double dist = 0;
				for (int i = p1.length - 1; i >= 0; i--) {
					final double d = (p1[i] - p2[i]);
					dist += d * d;
				}
				return Math.sqrt(dist);
			}
		}
	}
1181367
public static Double getDistanceWithinThresholdOfCoordinates(
            Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) {
        throw new NotImplementedError();
    }
1279866
function(lineP1, lineP2, point, radius) {
    var distance =
      Math.abs(
        ((lineP2.y - lineP1.y)*point.x) - ((lineP2.x - lineP1.x)*point.y) + (lineP2.x*lineP1.y) - (lineP2.y*lineP1.x)
      ) /
      Math.sqrt(
        Math.pow(lineP2.y - lineP1.y, 2) + Math.pow(lineP2.x - lineP1.x, 2)
      );
    return distance <= radius;
  }
252351
public static double distanceBetween(double latitude1, double longitude1, double latitude2, double longitude2) {
        double dLat = toRadians(latitude2 - latitude1);
        double dLon = toRadians(longitude2 - longitude1);
        latitude1 = toRadians(latitude1);
        latitude2 = toRadians(latitude2);

        double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(latitude1) * Math.cos(latitude2);
        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
        return EARTH_RADIUS * c;
    }
1359976
function(p1, p2)
	{
		var min = Math.min(p1.length, p2.length);
		var comp = 0;
		
		for (var i = 0; i < min; i++)
		{
			if (p1[i] != p2[i])
			{
				if (p1[i].length == 0 ||
					p2[i].length == 0)
				{
					comp = (p1[i] == p2[i]) ? 0 : ((p1[i] > p2[i]) ? 1 : -1);
				}
				else
				{
					var t1 = parseInt(p1[i]);
					var t2 = parseInt(p2[i]);
					
					comp = (t1 == t2) ? 0 : ((t1 > t2) ? 1 : -1);
				}
				
				break;
			}
		}
		
		// Compares path length if both paths are equal to this point
		if (comp == 0)
		{
			var t1 = p1.length;
			var t2 = p2.length;
			
			if (t1 != t2)
			{
				comp = (t1 > t2) ? 1 : -1;
			}
		}
		
		return comp;
	}
1041012
public static final double distance(double lat1, double lon1, double lat2, double lon2)
    {
        checkLatitude(lat1);
        checkLongitude(lon1);
        checkLatitude(lat2);
        checkLongitude(lon2);
        if (
                (Math.abs(lat1 - lat2) > 100) ||
                (Math.abs(lon1 - lon2) > 100)
                )
        {
            return GreatCircle.distance(lat1, lon1, lat2, lon2);
        }
        double dep = departure(lat1, lat2);
        return 60*Math.hypot(
                lat1-lat2,
                dep*(lon1-lon2)
                );
    }
540536
public double seriesDistance(double[][] series1, double[][] series2) throws Exception {
    if (series1.length == series2.length) {
      Double res = 0D;
      for (int i = 0; i < series1.length; i++) {
        res = res + distance2(series1[i], series2[i]);
      }
      return Math.sqrt(res);
    }
    else {
      throw new Exception("Exception in Euclidean distance: array lengths are not equal");
    }
  }
131156
public static final Point subtract(Point p1, Point p2)
    {
        return new AbstractPoint(p1.getX() - p2.getX(), p1.getY() - p2.getY());
    }
720294
def distance2_to(self, other: "Point2"):
        """"""
        assert isinstance(other, Point2)
        return (self[0] - other[0]) ** 2 + (self[1] - other[1]) ** 2
1209999
public static double euclidean(AssociativeArray a1, AssociativeArray a2) {
        Map<Object, Double> columnDistances = columnDistances(a1, a2, null);
        
        double distance = 0.0;
        for(double columnDistance : columnDistances.values()) {
            distance+=(columnDistance*columnDistance);
        }
        
        return Math.sqrt(distance);
    }
1156608
public double distance(Instance first, Instance second) {
    return distance(first, second, Double.POSITIVE_INFINITY);
  }
1316612
function(p1, p2) {
		_tempPoint.x = Math.abs( p1.x - p2.x );
		_tempPoint.y = Math.abs( p1.y - p2.y );
		return Math.sqrt(_tempPoint.x * _tempPoint.x + _tempPoint.y * _tempPoint.y);
	}
436747
public static int distance (int x1, int y1, int x2, int y2) {
        return (int)Math.sqrt(distanceSq(x1, y1, x2, y2));
    }
371886
public static boolean isSibling(String p1, String p2)
   {
      int pos1 = p1.lastIndexOf('/');
      int pos2 = p2.lastIndexOf('/');
      return (pos1 == pos2 && pos1 >= 0 && p1.regionMatches(0, p2, 0, pos1));
   }
380367
public static int distance (int x1, int y1, int x2, int y2)
    {
        int dx = x1-x2, dy = y1-y2;
        return (int)Math.sqrt(dx*dx+dy*dy);
    }
562372
@Pure
	public static boolean epsilonEqualsDistance(Point3D<?, ?> p1, Point3D<?, ?> p2) {
		final double distance = p1.getDistance(p2);
		return distance >= -distancePrecision && distance <= distancePrecision;
	}
224597
public static final double distance(final Point2D a, final Point2D b)
    {
        return Point2DJSO.distance(a.getJSO(), b.getJSO());
    }