Here you can find the source of distSquareVec3(final float[] v1, final float[] v2)
public static float distSquareVec3(final float[] v1, final float[] v2)
//package com.java2s; public class Main { /**// w w w. ja v a 2 s . c o m * Return the squared distance between the given two points described vector v1 and v2. * <p> * When comparing the relative distance between two points it is usually sufficient to compare the squared * distances, thus avoiding an expensive square root operation. * </p> */ public static float distSquareVec3(final float[] v1, final float[] v2) { final float dx = v1[0] - v2[0]; final float dy = v1[1] - v2[1]; final float dz = v1[2] - v2[2]; return dx * dx + dy * dy + dz * dz; } }