iOverlay
The iOverlay is a fast poly-bool library supporting main operations like union, intersection, difference, and xor, governed by either the even-odd or non-zero rule. This algorithm is based on Vatti clipping ideas but is an original implementation.
Documentation
Try out iOverlay with an interactive demo:
Features
- Operations: union, intersection, difference, and exclusion.
- Polygons: with holes, self-intersections, and multiple paths.
- Simplification: removes degenerate vertices and merges collinear edges.
- Fill Rules: even-odd and non-zero.
Getting Started
Add the following to your Cargo.toml:
[dependencies]
i_float
i_shape
i_overlay
Hello world
Let's union two squares
let mut overlay = new;
let left_bottom_square = new_with_contour;
let right_top_square = new_with_contour;
// add new geometry
overlay.add_shape;
overlay.add_shape;
// resolve shapes geometry
let graph = overlay.build_graph;
// apply union operation and get result (in our case it will be only one element)
let shapes = graph.extract_shapes;
// do something with new shapes...
print!