Skip to main content

clipper2_rust/
lib.rs

1//! # clipper2-rust
2//!
3//! A pure Rust port of the [Clipper2](https://github.com/AngusJohnson/Clipper2) polygon
4//! clipping and offsetting library by Angus Johnson.
5//!
6//! ## Features
7//!
8//! - **Boolean operations**: Intersection, Union, Difference, and XOR on polygons
9//! - **Polygon offsetting**: Inflate/deflate with Miter, Square, Bevel, and Round joins
10//! - **Rectangle clipping**: High-performance rectangular clipping
11//! - **Minkowski sum/difference**: Geometric Minkowski operations
12//! - **Path simplification**: Ramer-Douglas-Peucker and Clipper2's simplification
13//! - **PolyTree**: Hierarchical parent/child/hole polygon representation
14//! - **Dual precision**: Integer (`i64`) and floating-point (`f64`) coordinate support
15//!
16//! ## Quick Start
17//!
18//! ```rust
19//! use clipper2_rust::core::FillRule;
20//!
21//! let subject = vec![clipper2_rust::make_path64(&[100, 100, 300, 100, 300, 300, 100, 300])];
22//! let clip = vec![clipper2_rust::make_path64(&[200, 200, 400, 200, 400, 400, 200, 400])];
23//!
24//! let result = clipper2_rust::intersect_64(&subject, &clip, FillRule::NonZero);
25//! ```
26//!
27//! ## Coordinate Systems
28//!
29//! - [`Path64`] / [`Paths64`]: Integer coordinates (`i64`) — recommended for precision
30//! - [`PathD`] / [`PathsD`]: Floating-point coordinates (`f64`) — convenient for external data
31
32pub mod core;
33pub mod engine;
34pub mod engine_fns;
35pub mod engine_public;
36pub mod rectclip;
37pub mod version;
38
39pub mod clipper;
40pub mod minkowski;
41pub mod offset;
42pub mod utils;
43
44pub use clipper::*;
45pub use core::*;
46pub use engine::*;
47pub use engine_fns::*;
48pub use engine_public::*;
49pub use minkowski::*;
50pub use offset::*;
51pub use rectclip::*;
52pub use version::*;