I have two rectangles characterized by 4 values each :
Left position X
, top position Y
, width W
and height H
:
X1, Y1, H1, W1
X2, Y2, H2, W2
Rectangles are not rotated, like so:
+--------------------> X axis
|
| (X,Y) (X+W, Y)
| +--------------+
| | |
| | |
| | |
| +--------------+
v (X, Y+H) (X+W,Y+H)
Y axis
What is the best solution to determine whether the intersection of the two rectangles is empty or not?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…