3 releases (breaking)

0.3.0 Apr 25, 2021
0.2.0 Apr 6, 2021
0.1.0 Jul 3, 2019

#2244 in Algorithms

Download history 19/week @ 2023-12-07 2/week @ 2023-12-14 1/week @ 2023-12-21 9/week @ 2024-01-11 1/week @ 2024-01-18 4/week @ 2024-02-08 12/week @ 2024-02-15 33/week @ 2024-02-22 20/week @ 2024-02-29 9/week @ 2024-03-07 17/week @ 2024-03-14 5/week @ 2024-03-21

58 downloads per month
Used in aoer-plotty-rs

ISC license

27KB
675 lines

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::{Coordinate, Line};
use geo_offset::Offset;

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

let line_with_offset = line.offset(2.0)?;

lib.rs:

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::{Coordinate, Line};
use geo_offset::Offset;

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

let line_with_offset = line.offset(2.0)?;

Dependencies

~4–6.5MB
~122K SLoC