The operator &= function determines the intersection of two rectangles by comparing their components and selecting the right-most x1, bottom-most y1, Left-most x2, and top-most y2. The following expression is used to determine the result:
(x1, y1, x2, y2) = (max(x1, r1.x1), max(y1, r1.y1), min(x2, r1.x2), min(y2, r1.y2)
Parameters |
Description |
const Rect<T> & r |
A passed rectangle whose components are compared to those of second rectangle in order to determine the intersection. |
A Rect reference to a new string whose components are altered to represent the intersection of its original components and a passed rectangle. If the two rectangles do not intersect, it sets x1 to zero, y1 to zero, x2 to -1 and y2 to -1.