1 | initial version |
in c++, there is an "intersection" operator:
Rect a(20,20,40,40);
Rect b(30,30,40,40);
Rect c = a & b;
// [30 x 30 from (30, 30)]
(if the intersection is empty, they do not overlap)
2 | No.2 Revision |
in c++, there is an "intersection" operator:
Rect a(20,20,40,40);
Rect b(30,30,40,40);
Rect c = a & b;
// [30 x 30 from (30, 30)]
(if the intersection is empty, they do not overlap)
if you want to find out, if Rect a is completely inside Rect b, it is:
(a & b) == a;