Here you can find the source of distSq(double x1, double y1, double z1, double x2, double y2, double z2)
public static double distSq(double x1, double y1, double z1, double x2, double y2, double z2)
//package com.java2s; //License from project: Open Source License public class Main { public static double distSq(double x1, double y1, double z1, double x2, double y2, double z2) { return (sq(x2 - x1) + sq(y2 - y1) + sq(z2 - z1)); }/*w w w . ja v a 2 s. c o m*/ public static double sq(double f) { return f * f; } public static double sq(double f, int i) { if (i == 2) return sq(f); double f1 = 1D; for (int j = 0; j < i; j++) f1 *= f; return f1; } }