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