geo-offset

Crates.iogeo-offset
lib.rsgeo-offset
version0.3.0
sourcesrc
created_at2019-07-03 09:08:46.980276
updated_at2021-04-25 13:53:59.20185
descriptionAdd margin and padding to geometric shapes
homepage
repositoryhttps://github.com/lelongg/geo-offset
max_upload_size
id145593
size42,822
GĂ©rald Lelong (lelongg)

documentation

https://docs.rs/geo-offset/

README

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)?;
Commit count: 37

cargo fmt