Libraryless. Click here for Pure Java version (5133L/28K).
sclass BoundsFinder { int x1 = Int.MAX_VALUE, y1 = Int.MAX_VALUE, x2 = 0, y2 = 0; *() {} *(int w, int h) { x1 = w; y1 = h; } void addPt aka add(Pt p) { if (p != null) addPt(p.x, p.y); } void addPt aka add(int x, int y) { if (x < x1) x1 = x; if (x > x2) x2 = x; if (y < y1) y1 = y; if (y > y2) y2 = y; } Rect get() { ret rectFromPointsOrNull(x1, y1, x2+1, y2+1); } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034661 |
Snippet name: | BoundsFinder |
Eternal ID of this version: | #1034661/5 |
Text MD5: | f02c00cdefc4699fc45e1b86787272b0 |
Transpilation MD5: | 2db22ea53035da7e6df3e59f16ab4a3f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-18 23:13:21 |
Source code size: | 439 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 151 / 249 |
Version history: | 4 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |