Function offset_polygons

Source
pub fn offset_polygons(
    polygons: &[Polygon],
    distance: f64,
    join: JoinStyle,
    tolerance: Tolerance,
) -> Result<OffsetResult, OverlayError>
Expand description

Offset closed polygons by distance.

Positive grows, negative shrinks, zero is the identity. Holes are offset in the opposite direction to the outer boundary automatically, which is what makes an outset of a polygon-with-hole shrink the hole rather than grow it.

Returns OverlayError::ZeroArea and friends for malformed input via the same ring validation overlay applies, so the two operations cannot disagree about what a valid polygon is.