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 point-in-solid classifier casts 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//! The crate is held to instruments rather than trusted. They live in
26//! `tests/support/`, because measuring an intersector is not something a
27//! caller of one wants to do. What a caller wants is an intersector that has
28//! been measured.
29//!
30//! One scores accuracy: every point of every reported curve against both
31//! surfaces, with ground truth being the surfaces themselves rather than
32//! anyone else's answer. The other scores completeness: the surfaces are
33//! asked, by signed distance and the intermediate value theorem, where the
34//! intersection *must* be, and every such cell had better be reached by some
35//! branch. The second exists because the first cannot catch a missing answer:
36//! an intersector that finds one circle of two and traces it perfectly scores
37//! perfectly on accuracy alone. Both have negative controls in
38//! `tests/instruments.rs`. They demonstrably fail when something is genuinely
39//! missing.
40
41pub mod approx;
42pub mod curve_surface;
43pub mod curves;
44pub mod extrema;
45pub mod march;
46pub mod section;
47pub mod surface;
48pub mod walk;
49
50pub use approx::{IntersectionCurve, approximate_branch};
51pub use curve_surface::{
52    CurveSurfaceIntersection, CurveSurfaceOptions, Piercing, intersect_curve_surface,
53};
54pub use curves::{
55    Crossing, CurveCurveOptions, CurveIntersection, Overlap, intersect_curves, intersect_curves_2d,
56};
57pub use extrema::{
58    Approach, Extrema, ExtremaOptions, extrema_curve_curve, extrema_curve_surface,
59    extrema_surface_surface,
60};
61pub use march::{Contact, Marching, Stopped, Traced, branches, seeds, trace, trace_tangential};
62pub use section::{
63    IntersectOptions, SectionCurve, SurfaceIntersection, exact_pcurve_of, exact_pcurve_over,
64    intersect_surfaces,
65};
66pub use surface::{Meeting, surface_surface};
67pub use walk::{Condition, Walked, follow, walk_one_way};