Skip to main content

geometry_overlay/
lib.rs

1//! Boolean-overlay engine — the segment-intersection kernel and the
2//! machinery built on top of it.
3//!
4//! Mirrors `boost/geometry/algorithms/detail/overlay/`. Overlay is the
5//! engine behind `intersection`, `union`, `difference`,
6//! `sym_difference`, and (indirectly) `buffer`, `is_valid`, `relate`,
7//! `crosses`, `overlaps`, `touches`, `point_on_surface`, and
8//! `merge_elements`. Boost concentrates all of it under one `detail`
9//! directory; the port gives it its own crate because the algorithmic
10//! surface is too dense to share a crate with anything else.
11//!
12//! The build order is strict (see
13//! `specs/phase_03-rust-port-implementation-plan-overlay.md`):
14//!
15//! * [`predicate`] — OVL1: the robust predicate layer every overlay
16//!   operation eventually calls (orientation, in-circle,
17//!   segment-segment intersection, coordinate-range gate).
18//! * turn graph → traversal → output assembly → the four overlay free
19//!   functions land in later phases, each behind the same strict
20//!   ordering.
21//!
22//! # Robustness
23//!
24//! v1 uses **exact input arithmetic with no rescale** — the predicates
25//! compute directly on the `f64` inputs and the
26//! [`predicate::range_guard`] refuses inputs outside the safe
27//! arithmetic range rather than silently returning a wrong sign. See
28//! `specs/overlay-robustness-decision.md` for the rationale and the
29//! slot left for a future rescale policy.
30
31#![cfg_attr(not(feature = "std"), no_std)]
32#![forbid(unsafe_code)]
33
34extern crate alloc;
35
36pub mod assemble;
37pub mod buffer;
38pub mod merge;
39pub mod operation;
40pub mod predicate;
41pub mod relate;
42pub mod surface_point;
43pub mod traverse;
44pub mod turn;
45pub mod validity;
46
47pub use buffer::{JoinStrategy, PointStrategy, buffer_convex_polygon, buffer_point};
48pub use merge::{merge_multipolygon, merge_polygons};
49pub use operation::{OverlayError, difference, intersection, sym_difference, union_poly};
50pub use relate::{De9im, Dimension, crosses, overlaps, relate as relate_matrix, touches};
51pub use surface_point::point_on_surface;
52pub use validity::{ValidityFailure, is_valid_polygon, is_valid_ring};