| Crates.io | linesweeper |
| lib.rs | linesweeper |
| version | 0.0.4 |
| created_at | 2024-12-26 15:35:17.370799+00 |
| updated_at | 2025-05-24 07:46:37.783049+00 |
| description | Robust sweep-line algorithm and two-dimensional boolean ops |
| homepage | |
| repository | https://github.com/jneem/linesweeper |
| max_upload_size | |
| id | 1495714 |
| size | 1,213,689 |
This rust crate implements a "robust" version of the Bentley-Ottmann sweep-line algorithm, and uses it to provide various two-dimensional geometric primitives like boolean operations on sets bounded by Bézier paths. It is currently in an alpha state.

To compute binary operations between curves, use the binary_op function, which
takes in two paths and computes some binary operation on them:
use kurbo::Shape;
use linesweeper::{binary_op, FillRule, BinaryOp};
let square = kurbo::Rect::from_center_size((0.0, 0.0), (2.0, 2.0)).to_path(1e-6);
let circle = kurbo::Circle::new((0.0, 0.0), 1.2).to_path(1e-6);
binary_op(&square, &circle, FillRule::EvenOdd, BinaryOp::Intersection);
For more advanced usage (like custom n-ary operations) see Topology, or
the example in examples/bus.rs.