private static boolean isCompact(Point[] points) {
        long[] d = new long[6];
        int v = 0;
        for (int i = 0; i < 4; i++) {
            for (int j = i + 1; j < 4; j++) {
                d[v++] = dist(points[i], points[j]);
            }
        }

        Arrays.sort(d);
        return d[0] != 0
                && d[0] == d[1] && d[1] == d[2] && d[2] == d[3]
                && d[3] != d[4]
                && d[4] == d[5];
    }