raygeo.geo.algo.polylabel
Functions
find_largest_circle()
find_largest_circle(
shell: Sequence[tuple[float, float]],
holes: Sequence[Sequence[tuple[float, float]]] = [],
precision: float = 0.5,
) -> tuple[tuple[float, float], float] | None
Find the centre and radius of the largest inscribed circle.
| Parameter | Type | Description |
|---|---|---|
shell | Sequence[tuple[float, float]] | Outer boundary polygon. |
holes | Sequence[Sequence[tuple[float, float]]] = [] | List of hole polygons to exclude (default []). |
precision | float = 0.5 | Desired precision (default 0.5). |
| Returns | tuple[tuple[float, float], float] | None | ((x, y), radius) or None for degenerate polygons. |

find_largest_circle returns the centre and radius of the largest inscribed circle — the entry point and its clearance for helical versus ramp decisions
polylabel()
polylabel(
shell: Sequence[tuple[float, float]],
holes: Sequence[Sequence[tuple[float, float]]] = [],
precision: float = 0.5,
) -> tuple[float, float] | None
Find the pole of inaccessibility of a polygon (with optional holes).
Uses the Polylabel algorithm (Mapbox): a priority-queue of grid cells repeatedly subdivided until the cell radius drops below precision.
| Parameter | Type | Description |
|---|---|---|
shell | Sequence[tuple[float, float]] | Outer boundary polygon. |
holes | Sequence[Sequence[tuple[float, float]]] = [] | List of hole polygons to exclude (default []). |
precision | float = 0.5 | Desired precision (default 0.5). |
| Returns | tuple[float, float] | None | (x, y) of the most interior point, or None for degenerate polygons. |
| Complexity | O(n log n) where n is the number of cells explored. |

Polylabel: priority-queue cell refinement finds the point farthest from the boundary — the pole of inaccessibility

Multi-island pocket: the pole of inaccessibility sits in the largest valid region, farthest from all boundaries

Central-island pocket (annular): the pole of inaccessibility sits at the centre of the ring