public int[][] getLocationsToAdd(int segX, int segY, int pos, float angle) {
        int[][] result = null;
        
        int left = pos - 1;
        while (left < 0)
            left += 8;
        
        if ((pos + 1) % 2 == 0 && onEdge(segX, segY, pos)) {
            result = new int[][] { { segX, segY, pos - 1 }, { segX, segY, pos }, { 1 } };
        } else if (pos % 2 == 0) {
            double[] angles = new double[] { Math.PI / 4, 0, -Math.PI / 4, 0, -3 * Math.PI / 4, 0, 3 * Math.PI / 4 };
            if (angle < angles[pos] && onEdge(segX, segY, pos)) {
                result = new int[][] { { segX, segY, pos }, getLocationToLeft(segX, segY, pos), { 0 } };
            } else if (onEdge(segX, segY, left)) {
                result = new int[][] { { segX, segY, left }, getLocationToRight(segX, segY, left), { 1 } };
            }
        }
        return result;
    }