| Crates.io | geo-offset |
| lib.rs | geo-offset |
| version | 0.4.0 |
| created_at | 2019-07-03 09:08:46.980276+00 |
| updated_at | 2025-02-08 10:34:33.303413+00 |
| description | Add margin and padding to geometric shapes |
| homepage | |
| repository | https://github.com/lelongg/geo-offset |
| max_upload_size | |
| id | 145593 |
| size | 47,818 |
This crate contains algorithms to shrink and dilate various geometric shapes.
This code is a Rust port of the JS lib polygon-offset.
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)?;