1 2 3 4 5 6 7 8 9 10 11 12 13
| function IlYaInstersectionRect(const R1, R2: tRect): boolean;
// Renvoie True s'il y a intersection entre R1 et R2
var a1, a2, a3, a4: tPoint; ok1, ok2: boolean;
begin
a1 := R1.TopLeft; a2 := Point(R1.Left, R1.Bottom);
a3 := R1.BottomRight; a4 := Point(R1.Right, R1.Top);
ok1:=(PtInRect(R2, a1) or PtInRect(R2, a2) or PtInRect(R2, a3) or PtInRect(R2, a4));
a1 := R2.TopLeft; a2 := Point(R2.Left, R2.Bottom);
a3 := R2.BottomRight; a4 := Point(R2.Right, R2.Top);
ok2:=(PtInRect(R1, a1) or PtInRect(R1, a2) or PtInRect(R1, a3) or PtInRect(R1, a4));
Result:=ok1 or ok2;
end; |
Partager