Here you can find the source of squareDistance(double pointAX, double pointAY, double pointBX, double pointBY)
public static double squareDistance(double pointAX, double pointAY, double pointBX, double pointBY)
//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); } }