4 releases (breaking)

0.4.0 Feb 8, 2025
0.3.0 Apr 25, 2021
0.2.0 Apr 6, 2021
0.1.0 Jul 3, 2019

#1038 in Algorithms

Download history 33/week @ 2025-05-20 45/week @ 2025-05-27 38/week @ 2025-06-03 12/week @ 2025-06-10 2/week @ 2025-06-17 22/week @ 2025-06-24 15/week @ 2025-07-01 14/week @ 2025-07-08 5/week @ 2025-07-15 69/week @ 2025-07-22 104/week @ 2025-07-29 9/week @ 2025-08-05 55/week @ 2025-08-12 189/week @ 2025-08-19 108/week @ 2025-08-26 63/week @ 2025-09-02

416 downloads per month
Used in aoer-plotty-rs

ISC license

28KB
685 lines

This crate contains algorithms to shrink and dilate various geometric shapes.

This code is a Rust port of the JS lib polygon-offset.

Example

The following example shows how to compute an inflated line.
The offset method is provided by the Offset trait which is implemented for most geo-types.

use geo_types::{Coord, Line};
use geo_offset::Offset;

let line = Line::new(
    Coord { x: 0.0, y: 0.0 },
    Coord { x: 1.0, y: 8.0 },
);

let line_with_offset = line.offset(2.0)?;

geo-offset

This crate contains algorithms to shrink and dilate various geometric shapes.

crate.io docs.rs

This code is a Rust port of the JS lib polygon-offset.

Example

The following example shows how to compute an inflated line. The offset method is provided by the Offset trait which is implemented for most geo-types.

use geo_types::{Coord, Line};
use geo_offset::Offset;

let line = Line::new(
    Coord { x: 0.0, y: 0.0 },
    Coord { x: 1.0, y: 8.0 },
);

let line_with_offset = line.offset(2.0)?;

Dependencies

~2MB
~38K SLoC