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

19
LINES

< > BotCompany Repo | #1006664 // rectContains

JavaX fragment (include)

static bool rectContains(int x1, int y1, int w, int h, Pt p) {
  ret p.x >= x1 && p.y >= y1 && p.x < x1+w && p.y < y1+h;
}

static bool rectContains(Rect a, Rect b) {
  ret b.x >= a.x && b.y >= a.y && b.x2() <= a.x2() && b.y2() <= a.y2();
}

sbool rectContains(Rect a, Rectangle b) {
  ret rectContains(a, toRect(b));
}

sbool rectContains(Rect a, int x, int y) {
  ret a != null && a.contains(x, y);
}

sbool rectContains(Rect a, Pt p) {
  ret a != null && p != null && a.contains(p);
}

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: 487 / 3134
Version history: 5 change(s)
Referenced in: [show references]