Gets the Canberra distance between two points.

@param p A point in space.
@param q A point in space.
@return The Canberra distance between x and y.
491050
public static double Canberra(double[] p, double[] q) {
        double distance = 0;

        for (int i = 0; i < p.length; i++) {
            distance += Math.abs(p[i] - q[i]) / (Math.abs(p[i]) + Math.abs(q[i]));
        }

        return distance;
    }
342394
public double distance(int[] point1, int[] point2) throws Exception {
    return Math.sqrt(Long.valueOf(distance2(point1, point2)).doubleValue());
  }
409045
public static double BrayCurtis(double[] p, double[] q) {
        double sumP, sumN;
        sumP = sumN = 0;

        for (int i = 0; i < p.length; i++) {
            sumN += Math.abs(p[i] - q[i]);
            sumP += Math.abs(p[i] + q[i]);
        }

        return sumN / sumP;
    }
247774
public double sqrMaxDistance(Envelope2D other) {
		if (isEmpty() || other.isEmpty())
			return NumberUtils.TheNaN;

		double dist = 0;
		Point2D[] points = new Point2D[4];
		queryCorners(points);
		Point2D[] points_o = new Point2D[4];
		other.queryCorners(points_o);
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				double d = Point2D.sqrDistance(points[i], points_o[j]);
				if (d > dist) {
					dist = d;
				}
			}
		}

		return dist;
	}
1364030
static double distanceSq( Point2D_I32 a , Point2D_I32 b ) {
		double dx = b.x-a.x;
		double dy = b.y-a.y;

		return dx*dx + dy*dy;
	}
1290337
public static double SquaredEuclidean(IntPoint p, IntPoint q) {

        double dx = q.x - p.x;
        double dy = q.y - p.y;
        return dx * dx + dy * dy;

    }
192177
public double distance(double p1, double p2) {
    double d = (p1 - p2) * (p1 - p2);
    return Math.sqrt(d);
  }
245610
public void updateDistance(int p, int q) {
        float d = linkage.d(p, q);

        if (d < distance[p]) {
            distance[p] = q;
            neighbor[p] = q;
        } else if (neighbor[p] == q && d > distance[p]) {
            findNeighbor(p);
        }

        if (d < distance[q]) {
            distance[q] = p;
            neighbor[q] = p;
        } else if (neighbor[q] == p && d > distance[q]) {
            findNeighbor(q);
        }
    }
1107901
public static final Point move(Point p, double radians, double distance)
    {
        return new AbstractPoint(
                p.getX() + distance*Math.cos(radians),
                p.getY() + distance*Math.sin(radians)
                );
    }
671599
public static double Cosine(IntPoint p, IntPoint q) {
        return Cosine(p.x, p.y, q.x, q.y);
    }
565854
public static double Minkowski(double[] u, double[] v, double p) {
        double distance = 0;
        for (int i = 0; i < u.length; i++) {
            distance += Math.pow(Math.abs(u[i] - v[i]), p);
        }
        return Math.pow(distance, 1 / p);
    }
264680
private static double getSqDist(Point p1, Point p2) {
    double dx = p1.longitude() - p2.longitude();
    double dy = p1.latitude() - p2.latitude();
    return dx * dx + dy * dy;
  }
1365462
public static double distance(DLocation p1, DLocation p2) {
		double p1lat = Math.toRadians(p1.getLatitude());
		double p1lon = Math.toRadians(p1.getLongitude());
		double p2lat = Math.toRadians(p2.getLatitude());
		double p2lon = Math.toRadians(p2.getLongitude());
		return distance(p1lat, p1lon, p2lat, p2lon);
	}
5536
def pointToLineDistance(p, p1, p2):
    """"""
    d = np.sqrt(vtk.vtkLine.DistanceToLine(p, p1, p2))
    return d
157065
public static int distanceSq (int x1, int y1, int x2, int y2) {
        x2 -= x1;
        y2 -= y1;
        return x2 * x2 + y2 * y2;
    }
218184
function(p) {
        var v = this.b.sub(this.a);
        var t = p.sub(this.a).dot(v) / v.magSquared();
        // Check to see if t is beyond the extents of the line segment
        if (t < 0.0) {
            return this.a.copy();
        } else if (t > 1.0) {
            return this.b.copy();
        }
        // Return the point between 'a' and 'b'
        return this.a.add(v.scaleSelf(t));
    }
415267
public static double distance(Point p1, Point p2)
	{
		double x = p2.x - p1.x;
		double y = p2.y - p1.y;
		double z = p2.z - p1.z;
		return Math.sqrt(x * x + y * y + z * z);
	}