Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1006664 // rectContains

JavaX fragment (include)

1  
static bool rectContains(int x1, int y1, int w, int h, Pt p) {
2  
  ret p.x >= x1 && p.y >= y1 && p.x < x1+w && p.y < y1+h;
3  
}
4  
5  
static bool rectContains(Rect a, Rect b) {
6  
  ret b.x >= a.x && b.y >= a.y && b.x2() <= a.x2() && b.y2() <= a.y2();
7  
}
8  
9  
sbool rectContains(Rect a, Rectangle b) {
10  
  ret rectContains(a, toRect(b));
11  
}
12  
13  
sbool rectContains(Rect a, int x, int y) {
14  
  ret a != null && a.contains(x, y);
15  
}
16  
17  
sbool rectContains(Rect a, Pt p) {
18  
  ret a != null && p != null && a.contains(p);
19  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, elmgxqgtpvxh, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj

No comments. add comment

Snippet ID: #1006664
Snippet name: rectContains
Eternal ID of this version: #1006664/6
Text MD5: 7bf4532f31040c6b8fccb0b19b3a6934
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-25 20:00:27
Source code size: 505 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 491 / 3139
Version history: 5 change(s)
Referenced in: [show references]