Skip to main content

offset_polygon_rings

Function offset_polygon_rings 

Source
pub fn offset_polygon_rings(
    rings: &[Vec<(f64, f64)>],
    distance: f64,
    options: &OffsetOptions,
) -> Result<Vec<Vec<(f64, f64)>>>
Expand description

Compute parallel offset for each ring of a polygon independently.

Each ring is treated as a closed curve — all vertices are interior and no endpoint special-casing is applied. The bisector/miter join logic wraps cyclically around the ring.

A positive distance expands exterior rings outward; the caller is responsible for negating the distance for holes if needed.

§Errors

Returns AlgorithmError::InsufficientData if any input ring has < 3 distinct positions (i.e. the raw slice length is < 3).