Skip to main content

path_offset/
lib.rs

1//! # path-offset
2//! A simple library for offsetting paths.
3//!
4//! This library provides tools to perform path offsetting, a common operation in computer graphics and CAD.
5//! It leverages other powerful libraries for robust geometric calculations and provides a simple and flexible API.
6//!
7//! ## Features
8//!
9//! - **Path Offsetting**: Easily offset complex paths using different strategies.
10//! - **Multiple Backends**: Choose between `flo_curves` and `cavalier_contours` for the offsetting algorithm.
11//! - **Path Utilities**: Includes utilities for path manipulation, such as finding the outer shell of a complex path.
12//! - **SVG Path Support**: Parse SVG path data and convert paths back to SVG path strings.
13//!
14//! ## Usage
15//!
16//! Add this to your `Cargo.toml`:
17//!
18//! ```toml
19//! [dependencies]
20//! path-offset = "0.1.1"
21//! ```
22//!
23//! ### Offsetting a Path
24//!
25//! ```rust
26//! use path_offset::offset::Offset;
27//! use path_offset::path::Path;
28//! use std::str::FromStr;
29//!
30//! let path = Path::from_str("M10,10 L20,10 L20,20 L10,20 Z").unwrap();
31//!
32//! // Use one of the available offsetters
33//! let offsetter = path_offset::offset::cavalier_contours::CavalierContours::new(1.0);
34//! let offset_path = offsetter.offset_path(&path).unwrap();
35//!
36//! println!("Offset path: {}", offset_path);
37//! ```
38
39pub mod error;
40pub mod offset;
41pub mod path;