intersection

fun Box.intersection(other: Box): Box(source)

Computes the intersection of the current box with another box. If the two boxes intersect, the resulting box represents the overlapping region. If the two boxes do not intersect, an empty box is returned.

Return

A new box representing the overlapping region between the current box and the specified box, or an empty box if there is no intersection.

Parameters

other

The box to intersect with the current box.


fun Rectangle.intersection(other: Rectangle): Rectangle(source)

Computes the intersection of two rectangles and returns the resulting rectangle. If the rectangles do not intersect, an empty rectangle is returned.

Return

A Rectangle representing the overlapping area of the two rectangles, or an empty rectangle if there is no intersection.

Parameters

other

The rectangle to intersect with the current rectangle.