Skip to main content

Crate clipper2_rust

Crate clipper2_rust 

Source
Expand description

§clipper2-rust

A pure Rust port of the Clipper2 polygon clipping and offsetting library by Angus Johnson.

§Features

  • Boolean operations: Intersection, Union, Difference, and XOR on polygons
  • Polygon offsetting: Inflate/deflate with Miter, Square, Bevel, and Round joins
  • Rectangle clipping: High-performance rectangular clipping
  • Minkowski sum/difference: Geometric Minkowski operations
  • Path simplification: Ramer-Douglas-Peucker and Clipper2’s simplification
  • PolyTree: Hierarchical parent/child/hole polygon representation
  • Dual precision: Integer (i64) and floating-point (f64) coordinate support

§Quick Start

use clipper2_rust::core::FillRule;

let subject = vec![clipper2_rust::make_path64(&[100, 100, 300, 100, 300, 300, 100, 300])];
let clip = vec![clipper2_rust::make_path64(&[200, 200, 400, 200, 400, 400, 200, 400])];

let result = clipper2_rust::intersect_64(&subject, &clip, FillRule::NonZero);

§Coordinate Systems

  • Path64 / Paths64: Integer coordinates (i64) — recommended for precision
  • PathD / PathsD: Floating-point coordinates (f64) — convenient for external data

Re-exports§

pub use clipper::*;
pub use core::*;
pub use engine::*;
pub use engine_fns::*;
pub use engine_public::*;
pub use minkowski::*;
pub use offset::*;
pub use rectclip::*;
pub use version::*;

Modules§

clipper
Public API convenience functions for the Clipper2 library.
core
Core types and structures for Clipper2
engine
Main polygon clipping engine
engine_fns
Engine free functions - standalone utility functions for the sweep-line algorithm
engine_public
Public polygon clipper API types
minkowski
offset
Path offset (inflate/shrink) module.
rectclip
FAST rectangular clipping implementation
utils
version
Version information for Clipper2