vibespatial.constructive.normalize

GPU-accelerated geometry normalization.

Canonicalizes geometries by: - Rotating polygon rings to start at the lexicographically smallest (x,y) vertex - Reversing linestrings so the smaller endpoint comes first - Sorting multi-geometry parts by their first vertex

ADR-0033: Tier 1 NVRTC for ring rotation + lex-min scan, Tier 3a CCCL for multi-part sorting via segmented_sort. ADR-0002: COARSE class, dual fp32/fp64. Storage reads stay double, lex comparison uses compute_t after coordinate centering.

Functions

normalize_owned(...)

Normalize geometries to canonical form.

Module Contents

vibespatial.constructive.normalize.normalize_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray

Normalize geometries to canonical form.

GPU path uses NVRTC kernels for ring rotation and linestring reversal, CCCL segmented_sort for multi-part ordering. Falls back to Shapely for small inputs or when GPU is unavailable.