Here you can find the source of DistanceSquared(int x1, int z1, int x2, int z2)
public static double DistanceSquared(int x1, int z1, int x2, int z2)
//package com.java2s; //License from project: Open Source License public class Main { public static double DistanceSquared(int x1, int z1, int x2, int z2) { return Math.pow(x2 - x1, 2) + Math.pow(z2 - z1, 2); }/* w w w .j a v a 2 s. c o m*/ public static double DistanceSquared(int x1, int z1, int y1, int x2, int z2, int y2) { return Math.pow(x2 - x1, 2) + Math.pow(z2 - z1, 2) + Math.pow(y2 - y1, 2); } }