split

fun split(polygon: DrawnPolygon, shares: List<Double>, overlay: OverlayEngine, newVertexId: () -> VertexId, cutBearing: Double? = null): ShareSplitResult

Divides polygon into pieces whose areas are in proportion to shares (only the proportion counts: 1, 1, 2 and 0.25, 0.25, 0.5 are the same).

Parameters

overlay

what cuts the pieces out (for example JtsOverlayEngine(gridSize = 0.0) of the boolean-ops module; see above for why not its default).

newVertexId

makes the ids of the corners the cuts create.

cutBearing

the direction the cut lines run along, in degrees clockwise from north (any number: it is taken modulo 180); the shares are then laid side by side across them. null to let the cuts run across the long way of the plot, so that the pieces come out as compact as the plot allows: a long thin field is cut into short pieces and not into long strips.

Throws

if shares is empty or has a share that is not a positive number, the plot has no area, or it crosses the antimeridian (longitude 180: the overlay works on longitude and latitude as a flat plane and cannot cut across that line; Measure can still measure such a plot).

if polygon is not a valid polygon (it crosses itself, a hole lies outside it...).