ShareSplit

object ShareSplit

Divides a plot of land into shares of given sizes: three heirs with a half, a quarter and a quarter get three pieces whose areas are exactly in that proportion.

How: the cuts are parallel lines. Sweeping a line across the plot, the area on its one side only ever grows, so for each share the place where the area behind the line reaches that share's part of the whole is found by halving an interval (bisection), on the true area of the ellipsoid (see Measure), not on a flat approximation of it. Where the cuts lie are then cut out of the plot by OverlayEngine (which also gives the pieces of a plot that is not convex, or has a hole or a part of its own, whatever they look like).

For exact areas give an overlay that does not round: JtsOverlayEngine's default rounds every corner to a grid of 1e-7 degrees (a centimetre), which is what lets two sources of the same border agree, but it moves the corners a cut makes by a few millimetres, and on a cut of 100 m that is a few tenths of a square metre. With JtsOverlayEngine(gridSize = 0.0) the pieces have the areas asked for to a ten-millionth or better.

The plot is worked on a flat map in metres around its centre, which is right to a fifth of a percent of a distance at 10 km from the centre at the latitude of Turkey: the areas are measured on the ellipsoid, so that error does not touch them; it only means that the cuts are "parallel" on that flat map. A plot is expected to be a few kilometres across and not near a pole.

Functions

Link copied to clipboard
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).