splitAtY

fun Box.splitAtY(y: Double): List<Box>(source)

Splits the current Box object into two separate boxes along the given Y-coordinate. If the Y-coordinate falls within the vertical range of the box, the method produces two new boxes divided at the specified Y-coordinate. If the Y-coordinate is outside the vertical range, the method returns the original box unchanged.

Return

A list of Box objects, containing either two new boxes split at the specified Y-coordinate, or the original box if the Y-coordinate is outside the vertical range.

Parameters

y

The Y-coordinate at which the box should be split.


fun Rectangle.splitAtY(y: Double): List<Rectangle>(source)

Splits the rectangle horizontally at the specified y value if the value lies within the rectangle's vertical range.

Return

A list of rectangles resulting from the split. If the y value is outside the vertical range, the original rectangle is returned as a single-item list.

Parameters

y

The vertical value along the y-axis at which to split the rectangle.