Zum Hauptinhalt springen

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.

ParameterTypeDescription
shellSequence[tuple[float, float]]Outer boundary polygon.
holesSequence[Sequence[tuple[float, float]]] = []List of hole polygons to exclude (default []).
precisionfloat = 0.5Desired precision (default 0.5).
Returnstuple[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

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.

ParameterTypeDescription
shellSequence[tuple[float, float]]Outer boundary polygon.
holesSequence[Sequence[tuple[float, float]]] = []List of hole polygons to exclude (default []).
precisionfloat = 0.5Desired precision (default 0.5).
Returnstuple[float, float] | None(x, y) of the most interior point, or None for degenerate polygons.
ComplexityO(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

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

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

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