Skip to content
This repository was archived by the owner on Jan 25, 2026. It is now read-only.
/ linesweeper Public archive

Robust path ops in Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

jneem/linesweeper

Repository files navigation

linesweeper: a robust sweep-line algorithm

linesweeper has moved to Radicle!

The new repository ID is rad:z2jbcL8tV3Fqqqk1yPyGkDTjgaTfH. There is a web interface available.

GitHub Actions CI status. Latest published version. Documentation build status.

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 early beta state.

Image demonstrating set operations applied to the linebender logo

Basic usage

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);

Advanced usage

For more advanced usage (like custom n-ary operations) see Topology, or the example in examples/bus.rs.

About

Robust path ops in Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Contributors