polyops 0.0.1

Martinez-Rueda polygon clipping algorithm: Boolean operations (intersection, union, difference, xor) over polygons and multipolygons. Rust port of martinez-polygon-clipping.
Documentation

PolyOps

Fast polygon Boolean operations in Rust, with first-class Node.js bindings.

PolyOps is a faithful port of martinez-polygon-clipping (Alex Milevski's JavaScript implementation of the Martinez-Rueda-Feito algorithm) into idiomatic Rust, with a napi-rs wrapper so the same engine can be consumed from Node.js without giving up native performance.

Status: pre-alpha. The Martinez-Rueda algorithm has been ported and is covered by parity tests against upstream fixtures. The public API may still change before a stable release.

Operations

intersection(subject, clipping)
union       (subject, clipping)
difference  (subject, clipping)
xor         (subject, clipping)

All four operate on GeoJSON-shaped Polygon or MultiPolygon coordinate arrays, matching the upstream JS API.

Packages

Registry Name Source
crates.io polyops crates/polyops
npm polyops crates/polyops-napi

Layout

PolyOps/
├── crates/
│   ├── polyops/          pure-Rust crate (algorithm, types, tests)
│   └── polyops-napi/     napi-rs binding, published to npm
├── parity/               Node harness: runs martinez-polygon-clipping@0.8.1
│                         against all upstream fixtures, emits goldens
└── .github/workflows/    CI: cargo test + parity tests

Development

cargo test          # runs unit + parity tests
cargo bench         # runs benchmarks
cargo clippy        # lints
cargo fmt --check

To regenerate the parity goldens against the latest upstream:

cd parity
npm install
npm run generate

License

MIT. See LICENSE. Credit to Alexander Milevski for the JS reference implementation and to Martinez/Rueda/Feito for the algorithm.