Skip to main content

ogeom_intersect/
lib.rs

1//! Intersection: where curves and surfaces meet.
2//!
3//! *Elsewhere:* `IntPatch`, `GeomInt`, `IntAna`, `IntCurve`, `IntCurveSurface`,
4//! `IntWalk`, `IntSurf`, `ApproxInt` and `Extrema`.
5//!
6//! The entry points, by what is being intersected:
7//!
8//! - [`intersect_surfaces`]: surface/surface, the one `ogeom-bool` builds on.
9//!   Analytic closed forms where they exist, with exact same-parameter
10//!   pcurves; the marching-and-fitting pipeline where they do not, with the
11//!   tolerance reported as a sum of stated parts.
12//! - [`intersect_curves_2d`] / [`intersect_curves`]: curve/curve in the
13//!   plane and in space. The planar one is what boolean face splitting runs
14//!   on; the spatial one reports the gap each crossing achieved, because
15//!   space curves generically miss.
16//! - [`intersect_curve_surface`]: curve/surface, the well-posed system, and
17//!   what the exact point-in-solid classifier will cast its rays with.
18//!
19//! The stages underneath are public because each is separately measurable:
20//! [`surface_surface`] (the closed forms), [`seeds`]/[`trace`]/[`branches`]
21//! (the marcher), [`approximate_branch`] (polyline to curves).
22//!
23//! # The instruments
24//!
25//! **This crate was the project's single largest risk** (no Rust equivalent
26//! existed, and it is where prior open-source B-rep efforts failed), so it is
27//! held to instruments rather than trusted. They live in `tests/support/`,
28//! because measuring an intersector is not something a caller of one wants to
29//! do; what a caller wants is an intersector that has been measured.
30//!
31//! One scores accuracy: every point of every reported curve against both
32//! surfaces, with ground truth being the surfaces themselves rather than
33//! anyone else's answer. The other scores completeness: the surfaces are
34//! asked, by signed distance and the intermediate value theorem, where the
35//! intersection *must* be, and every such cell had better be reached by some
36//! branch. The second exists because the first cannot catch a missing answer:
37//! an intersector that finds one circle of two and traces it perfectly scores
38//! perfectly on accuracy alone. Both have negative controls in
39//! `tests/instruments.rs`; they demonstrably fail when something is genuinely
40//! missing.
41//!
42//! What this still lacks is an input no one here generated: a published
43//! corpus. Until that lands, the numbers say the machinery is sound on what it
44//! has seen, and they say nothing more than that.
45
46pub mod approx;
47pub mod curve_surface;
48pub mod curves;
49pub mod extrema;
50pub mod march;
51pub mod section;
52pub mod surface;
53pub mod walk;
54
55pub use approx::{IntersectionCurve, approximate_branch};
56pub use curve_surface::{
57    CurveSurfaceIntersection, CurveSurfaceOptions, Piercing, intersect_curve_surface,
58};
59pub use curves::{
60    Crossing, CurveCurveOptions, CurveIntersection, Overlap, intersect_curves, intersect_curves_2d,
61};
62pub use extrema::{
63    Approach, Extrema, ExtremaOptions, extrema_curve_curve, extrema_curve_surface,
64    extrema_surface_surface,
65};
66pub use march::{Contact, Marching, Stopped, Traced, branches, seeds, trace, trace_tangential};
67pub use section::{
68    IntersectOptions, SectionCurve, SurfaceIntersection, exact_pcurve_of, exact_pcurve_over,
69    intersect_surfaces,
70};
71pub use surface::{Meeting, surface_surface};
72pub use walk::{Condition, Walked, follow, walk_one_way};