Expand description
§linesweeper: a robust sweep-line algorithm
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.
§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.
Modules§
- curve
- Curve comparison utilities.
- order
- Curve order comparisons, with caching.
- sweep
- The sweep-line implementation.
- topology
- Utilities for computing topological properties of closed paths.
Structs§
- Point
- A two-dimensional point.
- SegIdx
- An index into our segment arena.
- Segment
- A contour segment.
- Segments
- An arena of segments, each of which is a cubic Bézier.
Enums§
- Binary
Op - Binary operations between sets.
- Error
- The input points were faulty.
- Fill
Rule - A fill rule tells us how to decide whether a point is “inside” a polyline.
Functions§
- binary_
op - Computes a boolean operation between two sets, each of which is described as a collection of closed polylines.
- binary_
op_ with_ eps - Computes a boolean operation between two sets, each of which is described as a collection of closed polylines.