Java 15 lines concise solution with comments
Java\n    public int[][] spiralMatrixIII(int R, int C, int r0, int c0) {\n        int[][] dirt = new int[][]{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; // east, south, 
```Java\n    public int[][] spiralMatrixIII(int R, int C, int r0, int c0) {\n        int[][] dirt = new int[][]{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; // east, south, west, north\n        List<int[]> res = new ArrayList<>();\n        int len = 0, d = 0; // move <len> steps in the <d> direction\n        res.add(new int[]{r0, c0});\n        while (res.size() < R * C) {\n            if (d == 0 || d == 2) len++; // when move east or west, the length of path need plus 1 \n            for (int i = 0; i < len; i++) {\n                r0 += dirt[d][0];\n                c0 += dirt[d][1];\n                if (r0 >= 0 && r0 < R && c0 >= 0 && c0 < C) // check valid\n                    res.add(new int[]{r0, c0});\n            }\n            d = (d + 1) % 4; // turn to next direction\n        }\n        return res.toArray(new int[R * C][2]);\n    }\n```
[]