I have two rectangles which I must return in a function whether they intersect or not.
They are represented by [ x0, y0, x1, y1 ]
pairs that represent the t
Give rectangle 1 with points UL1 and LR1 and rectangle 2 with points UR2 and LR2 -
Check if UL1 is in r2 or LR1 is in r2 (case 1 and case 2 in diagram). Finally check if one of UR2 / LR2 is in r1 (case 3 in diagram).
You check if a point is in a rectangle by checking that x and y are between min and max of a rectangles' x and y range.
Clear?
Blue is R1, Purple is R2