Java Distance Calculate squareDistance(double pointAX, double pointAY, double pointBX, double pointBY)

Here you can find the source of squareDistance(double pointAX, double pointAY, double pointBX, double pointBY)

Description

Returns the square distance between two points.

License

Open Source License

Declaration

public static double squareDistance(double pointAX, double pointAY, double pointBX, double pointBY) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Black Rook Software
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 ******************************************************************************/

public class Main {
    /**//from   w  ww .  j  a  v  a 2  s. c  o  m
     * Returns the square distance between two points.
     */
    public static double squareDistance(double pointAX, double pointAY, double pointBX, double pointBY) {
        return (pointAX - pointBX) * (pointAX - pointBX) + (pointAY - pointBY) * (pointAY - pointBY);
    }
}

Related

  1. getDistance(double lat1, double lng1, double lat2, double lng2)
  2. sqrDistance(float x1, float y1, float x2, float y2)
  3. squaredDistance(float[] p, int a, int b)
  4. squaredEuclideanDistance(double[] x, double[] y)
  5. squareDist31TileMetric(int x1, int y1, int x2, int y2)
  6. squareDistance(double x1, double y1, double x2, double y2)
  7. squaredistance(double[] v1, double[] v2)
  8. squareDistance(final double[] a, final double[] b)
  9. squareLength(final float x1, final float y1, final float z1, final float x2, final float y2, final float z2)