Libraryless. Click here for Pure Java version (4640L/26K).
1 | static <A> Matrix<Matrix<A>> matrixToMNGrid(Matrix<A> m, int cols, int rows) {
|
2 | if (m == null) null; |
3 | |
4 | // make reasonable |
5 | cols = clamp(cols, 1, m.getWidth()); |
6 | rows = clamp(rows, 1, m.getHeight()); |
7 | |
8 | LL<Rect> rects = gridOfRects3(m.getWidth(), m.getHeight(), cols, rows); |
9 | LL<Matrix<A>> matrices = mapLevelTwo(r -> new SubMatrix(m, r), rects); |
10 | ret listOfListsToMatrix(matrices); |
11 | } |
Began life as a copy of #1033120
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033125 |
| Snippet name: | matrixToMNGrid |
| Eternal ID of this version: | #1033125/3 |
| Text MD5: | 7c9370f0f63d4f82c879e4e2d7a5cbd0 |
| Transpilation MD5: | b7f4a245d8e4b6fc7306abba244cd82a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-10-15 22:56:55 |
| Source code size: | 401 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 397 / 523 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |