IntersectsWith(Rect: IGxRect): Boolean;
Rect. Integer rectangle, with which it is necessary to check intersection.
The IntersectsWith method checks if the current rectangle intersects with the rectangle passed as an input parameter.
Sub UserProc;
Var
r1, r2: IGxRect;
b: Boolean;
Begin
r1 := New GxRect.Create(-10, -10, Math.RandBetweenI(0, 20), Math.RandBetweenI(0, 20));
r2 := New GxRect.Create(0, 0, Math.RandBetweenI(0, 10), Math.RandBetweenI(0, 10));
b := r1.IntersectsWith(r2);
Debug.WriteLine(b ? "Rectangles intersect" : "Rectangles do not intersect");
End Sub UserProc;
After executing the example two rectangles with fixed start points but random size are created. The development environment console displays a message about intersection of the obtained rectangles.
See also: