geo_offset/
lib.rs

1//! This crate contains algorithms to shrink and dilate various geometric shapes.
2//!
3//! This code is a Rust port of the JS lib [polygon-offset](https://github.com/w8r/polygon-offset).
4//!
5//! # Example
6//!
7//! The following example shows how to compute an inflated line.  
8//! The [`offset`] method is provided by the [`Offset`] trait which is implemented for most [geo-types](https://docs.rs/geo-types/0.4.3/geo_types/).
9//!
10//! ```
11//! # fn main() -> Result<(), geo_offset::OffsetError> {
12//! use geo_types::{Coord, Line};
13//! use geo_offset::Offset;
14//!
15//! let line = Line::new(
16//!     Coord { x: 0.0, y: 0.0 },
17//!     Coord { x: 1.0, y: 8.0 },
18//! );
19//!
20//! let line_with_offset = line.offset(2.0)?;
21//! # Ok(())
22//! # }
23//! ```
24//!
25//! [`Offset`]: offset/trait.Offset.html
26//! [`offset`]: offset/trait.Offset.html#method.offset
27
28mod edge;
29pub use edge::*;
30
31mod offset;
32pub use offset::*;
33
34#[cfg(test)]
35mod tests;