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//! * [`operation`] — OVL5: a split-edge arrangement handles crossings,
18//! colocations, shared edges, traversal, and output assembly for the four
19//! Cartesian polygon Boolean operations.
20//! * [`mod@relate`] / [`validity`] / [`mod@buffer`] — the public topology consumers
21//! layered on those predicates and operations.
22//!
23//! # Robustness
24//!
25//! The Cartesian kernel uses **adaptive expansion predicates with no
26//! rescale**. [`predicate::range_guard`] refuses inputs outside the supported
27//! arithmetic range rather than silently returning a wrong sign.
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 line_intersection;
37pub mod merge;
38pub mod operation;
39pub mod predicate;
40pub mod relate;
41pub mod surface_point;
42pub mod traverse;
43pub mod turn;
44pub mod validity;
45
46// feature-group: Boolean operations
47// feature-desc: Overlay and offset of areal geometries
48pub use buffer::{
49 JoinStrategy, PointStrategy, buffer, buffer_convex_polygon, buffer_point, buffer_with,
50 buffer_with_strategy,
51};
52// feature-group: Boolean operations
53pub use line_intersection::{LineIntersection, line_intersection};
54// feature-group: Mutation & assembly
55pub use merge::{merge_elements, merge_multipolygon, merge_polygons, stitch_triangles};
56// feature-group: Boolean operations
57pub use operation::{OverlayError, difference, intersection, sym_difference, r#union, union_poly};
58// feature-group: Spatial predicates
59pub use relate::{
60 De9im, Dimension, RelateError, contains_properly, crosses, overlaps, relate as relate_matrix,
61 relate as relation, relate_mask as relate, touches,
62};
63// feature-group: Boolean operations
64pub use surface_point::point_on_surface;
65// feature-group: Inspection
66pub use validity::{
67 ValidityFailure, ValidityOptions, is_valid, is_valid_polygon, is_valid_polygon_with,
68 is_valid_ring, is_valid_ring_with, is_valid_with, validity_reason, validity_reason_with,
69};