Ask Your Question

Revision history [back]

click to hide/show revision 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)

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;