Expand description
The grid and interned-CSR builder.
The builder makes two passes over the geometry:
- The edge walk: every cell a ring passes through collects that feature id into its candidate set, and a cell with ≥2 candidates is a border cell needing PIP.
- The scanline fill on a subdivision-finer grid: an even-odd span fill
per polygon gives per-subcell ownership, aggregated to a dominant
zone per cell (the interior fill for the primary array and the
lookup_coarseanswer).
Structs§
- Cell
Grid - Cell arrays are
[row, col]-indexed and iterate row-major, the same order the primary table serializes in. - Csr
- The serializable grid prefilter: it stores one u16 per cell plus the interned candidate lists in compressed-sparse-row form.
Enums§
- Order
- The candidate-list ordering inside the interned CSR.
Functions§
- build
- Rasterizes
featsonto adeg-cell grid, with ownership sampled on a gridsubdivision× finer (subdivision = 8 at 2° gives 0.25° subcells). - feat_
areas - Approximates the global area per feature (an equirectangular shoelace with cos-lat correction; exteriors minus holes, clamped ≥ 0). The values serve ranking only.
- grid_
dims - The grid dimensions for a cell size,
(ncols, nrows)=ceil(360/deg) × ceil(180/deg). The sweep tools share this with the encoder so their cell counts measure exactly the grid it builds. - intern_
csr - Builds the interned CSR.
areas(global zone area, in any consistent unit) is used byAreaDescandCellDominantFirst. - walk_
edge - Walks the segment
start→endindeg-sized steps at 2× oversampling (the rasterizer’s edge density), visiting every interpolated point including both endpoints. Cell membership per point isutz_common::grid_cell(); the sweep tools share this walk so a change to the sampling density cannot leave them measuring a different rasterization than the encoder’s.