Returns the bounding box of the union of `this` and `b`. */
| 399 | } |
| 400 | /** Returns the bounding box of the union of `this` and `b`. */ |
| 401 | Rect expand(Rect b) const { |
| 402 | Rect r; |
| 403 | r.pos.x = std::fmin(pos.x, b.pos.x); |
| 404 | r.pos.y = std::fmin(pos.y, b.pos.y); |
| 405 | r.size.x = std::fmax(pos.x + size.x, b.pos.x + b.size.x) - r.pos.x; |
| 406 | r.size.y = std::fmax(pos.y + size.y, b.pos.y + b.size.y) - r.pos.y; |
| 407 | return r; |
| 408 | } |
| 409 | /** Returns the intersection of `this` and `b`. */ |
| 410 | Rect intersect(Rect b) const { |
| 411 | Rect r; |