splitAtX

fun Box.splitAtX(x: Double): List<Box>(source)

Splits the current Box into two smaller Boxes at the specified x-coordinate if the coordinate resides within the box's x-axis range.

Return

A list of Boxes. If the x-coordinate is within the range, it returns two boxes resulting from the split. Otherwise, it returns a single-element list containing the current box.

Parameters

x

The x-coordinate at which to split the box.


fun Rectangle.splitAtX(x: Double): List<Rectangle>(source)

Splits the current Rectangle into two smaller rectangles at a specified x-coordinate.

If the given x-coordinate lies within the range of the current rectangle's width, the method returns two rectangles: one to the left and one to the right of the specified x-coordinate. If the x-coordinate is outside the bounds of the rectangle, the method returns a list containing only the current rectangle.

Return

A list of rectangles resulting from the split. The list contains two rectangles if the split occurs within the bounds of the current rectangle, or the original rectangle if the x-coordinate is outside its bounds.

Parameters

x

The x-coordinate at which the rectangle is to be split.