Libraryless. Click here for Pure Java version (5146L/29K).
1 | svoid orBitMatrixWithItselfShifted(int dx, int dy, BitMatrix m) { |
2 | if (dx == 0 && dy == 0); |
3 | int w = m.getWidth(), h = m.getHeight(); |
4 | if (dx <= 0 && dy <= 0) { |
5 | for (int y = -dy; y < h; y++) |
6 | for (int x = -dx; x < h; x++) |
7 | if (m.get(x, y)) |
8 | m.set(x+dx, y+dy, true); |
9 | } else if (dx <= 0 && dy > 0) { |
10 | for (int y = 0; y < h-y; y++) |
11 | for (int x = -dx; x < h; x++) |
12 | if (m.get(x, y)) |
13 | m.set(x+dx, y+dy, true); |
14 | } else if (dx > 0 && dy <= 0) { |
15 | for (int y = -dy; y < h; y++) |
16 | for (int x = 0; x < h-dx; x++) |
17 | if (m.get(x, y)) |
18 | m.set(x+dx, y+dy, true); |
19 | } else if (dx > 0 && dy > 0) { |
20 | for (int y = 0; y < h-dy; y++) |
21 | for (int x = 0; x < h-dx; x++) |
22 | if (m.get(x, y)) |
23 | m.set(x+dx, y+dy, true); |
24 | } |
25 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033853 |
Snippet name: | orBitMatrixWithItselfShifted |
Eternal ID of this version: | #1033853/5 |
Text MD5: | 9260f812c895c0caa88146d250e73073 |
Transpilation MD5: | 60f087a6a5801ad4f1b2ccbeeefa2d11 |
Author: | stefan |
Category: | javax / gazelle v |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-07 04:27:38 |
Source code size: | 817 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 126 / 187 |
Version history: | 4 change(s) |
Referenced in: | [show references] |