r2->Bottom < r1->Top &&

r2->Top > r1->Bottom &&

r2->Left < r1->Right ]]>

The intersect condition is much simpler than how you have expressed in those 9 segments. There are really only 2 “segments” and you only need to check for one corner in each.

It is simple:

IF

TOPLEFT is in S1 || S2 || S4 || S5

AND

BOTTOMRIGHT is in S5 || S6 || S8 || S9

then you have intersecting rectangles.

The code has the same number of conditions as what the blog example has:

r2->Right > r1->Left &&

r2->Bottom Top &&

r2->Top > r1->Right &&

r2->Left Bottom