pub fn signed_area_2x<V: Vertex>(ring: &[V]) -> i128Expand description
Twice the signed area of ring (the shoelace sum Σ xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ), exact for any i32
ring. Works whether or not the ring repeats its first vertex, and is 0 for a degenerate ring.
The sign is the ring’s winding: positive turns counter-clockwise with y up — which is
clockwise on screen with y down, i.e. an MVT exterior ring in tile coordinates — and
negative the other way. The slicer preserves each input ring’s winding (synthetic corners
follow it), so a caller that needs a fixed convention (MVT: exterior positive, holes negative)
normalizes once per feature before slicing, reversing any ring whose sign disagrees with its role.
Accumulated in i128: each term is a cross product of two i32-difference vectors (< 2^65), so
the sum cannot overflow below 2^62 vertices.