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:
13//!
14//! * [`predicate`] — OVL1: the robust predicate layer every overlay
15//! operation eventually calls (orientation, in-circle,
16//! segment-segment intersection, coordinate-range gate).
17//! * turn graph → traversal → output assembly → the four overlay free
18//! functions land in later phases, each behind the same strict
19//! ordering.
20//!
21//! # Robustness
22//!
23//! v1 uses **exact input arithmetic with no rescale** — the predicates
24//! compute directly on the `f64` inputs and the
25//! [`predicate::range_guard`] refuses inputs outside the safe
26//! arithmetic range rather than silently returning a wrong sign,
27//! leaving a slot for a future rescale policy.
28
29#![cfg_attr(not(feature = "std"), no_std)]
30#![forbid(unsafe_code)]
31
32extern crate alloc;
33
34pub mod assemble;
35pub mod buffer;
36pub mod merge;
37pub mod operation;
38pub mod predicate;
39pub mod relate;
40pub mod surface_point;
41pub mod traverse;
42pub mod turn;
43pub mod validity;
44
45pub use buffer::{JoinStrategy, PointStrategy, buffer_convex_polygon, buffer_point};
46pub use merge::{merge_multipolygon, merge_polygons};
47pub use operation::{OverlayError, difference, intersection, sym_difference, union_poly};
48pub use relate::{De9im, Dimension, crosses, overlaps, relate as relate_matrix, touches};
49pub use surface_point::point_on_surface;
50pub use validity::{ValidityFailure, is_valid_polygon, is_valid_ring};