irregularGrid

fun Rectangle.irregularGrid(columnWeights: List<Double>, rowWeights: List<Double>, marginX: Double = 0.0, marginY: Double = 0.0): RectangleGrid(source)

Divides a rectangle into a grid of sub-rectangles with irregular spacing, based on the specified column and row weights. Optionally, margins can be applied on both the horizontal and vertical directions.

Return

A list of lists, where each sublist represents a row of the grid, and each element within the row is a sub-rectangle corresponding to a cell in the grid.

Parameters

columnWeights

A list of relative weights for the columns. The size of this list determines the number of columns, and each weight defines the proportional width of the respective column.

rowWeights

A list of relative weights for the rows. The size of this list determines the number of rows, and each weight defines the proportional height of the respective row.

marginX

The horizontal margin between the edges of the main rectangle and the grid. Defaults to 0.0.

marginY

The vertical margin between the edges of the main rectangle and the grid. Defaults to 0.0.