protected double getMinChildDistance()

in commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/PointMap3DImpl.java [196:223]


        protected double getMinChildDistance(final int childIdx, final Vector3D pt, final int ptLoc) {
            final int childLoc = CHILD_LOCATIONS[childIdx];

            final boolean sameX = (ptLoc & XMASK) == (childLoc & XMASK);
            final boolean sameY = (ptLoc & YMASK) == (childLoc & YMASK);
            final boolean sameZ = (ptLoc & ZMASK) == (childLoc & ZMASK);

            final Vector3D diff = pt.subtract(split);

            if (sameX) {
                if (sameY) {
                    return sameZ ?
                            0d :
                            Math.abs(diff.getZ());
                }
                return sameZ ?
                        Math.abs(diff.getY()) :
                        Vectors.norm(diff.getY(), diff.getZ());
            } else if (sameY) {
                return sameZ ?
                        Math.abs(diff.getX()) :
                        Vectors.norm(diff.getX(), diff.getZ());
            } else if (sameZ) {
                return Vectors.norm(diff.getX(), diff.getY());
            }

            return diff.norm();
        }