(Rect a, Rect b)
| 69 | } |
| 70 | |
| 71 | static public Rect intersection(Rect a, Rect b) |
| 72 | { |
| 73 | float minx = (float) Math.min(a.x+a.w, b.x+b.w); |
| 74 | float miny = (float) Math.min(a.y+a.h, b.y+b.h); |
| 75 | |
| 76 | float maxx= (float) Math.max(a.x, b.x); |
| 77 | float maxy = (float) Math.max(a.y, b.y); |
| 78 | |
| 79 | return new Rect(maxx, maxy, Math.max(0, minx-maxx), Math.max(0, miny-maxy)); |
| 80 | } |
| 81 | |
| 82 | public Rect translate(Vec2 by) |
| 83 | { |