Skip to main content

ogeom_intersect/
lib.rs

1//! Intersection: where curves and surfaces meet.
2//!
3//! The entry points, by what is being intersected:
4//!
5//! - [`intersect_surfaces`]: surface/surface, the one `ogeom-bool` builds on.
6//!   Analytic closed forms where they exist, with exact same-parameter
7//!   pcurves; the marching-and-fitting pipeline where they do not, with the
8//!   tolerance reported as a sum of stated parts.
9//! - [`intersect_curves_2d`] / [`intersect_curves`]: curve/curve in the
10//!   plane and in space. The planar one is what boolean face splitting runs
11//!   on; the spatial one reports the gap each crossing achieved, because
12//!   space curves generically miss.
13//! - [`intersect_curve_surface`]: curve/surface, the well-posed system, and
14//!   what the point-in-solid classifier casts its rays with.
15//!
16//! The stages underneath are public because each is separately measurable:
17//! [`surface_surface`] (the closed forms), [`seeds`]/[`trace`]/[`branches`]
18//! (the marcher), [`trace_tangential`] (a contact, where the surfaces touch
19//! along a curve without crossing), [`approximate_branch`] (polyline to
20//! curves).
21//!
22//! # The instruments
23//!
24//! The crate is held to instruments rather than trusted. They live in
25//! `tests/support/`, because measuring an intersector is not something a
26//! caller of one wants to do. What a caller wants is an intersector that has
27//! been measured.
28//!
29//! One scores accuracy: every point of every reported curve against both
30//! surfaces, with ground truth being the surfaces themselves rather than
31//! anyone else's answer. The other scores completeness: the surfaces are
32//! asked, by signed distance and the intermediate value theorem, where the
33//! intersection *must* be, and every such cell had better be reached by some
34//! branch. The second exists because the first cannot catch a missing answer:
35//! an intersector that finds one circle of two and traces it perfectly scores
36//! perfectly on accuracy alone. Both have negative controls in
37//! `tests/instruments.rs`. They demonstrably fail when something is genuinely
38//! missing.
39
40pub mod approx;
41mod bezier_clip;
42pub mod contact;
43pub mod curve_surface;
44pub mod curves;
45pub mod extrema;
46mod extrusion;
47pub mod march;
48pub mod section;
49pub mod surface;
50pub mod walk;
51
52pub use approx::{IntersectionCurve, approximate_branch};
53pub use contact::trace_tangential;
54pub use curve_surface::{
55    CurveSurfaceIntersection, CurveSurfaceOptions, Piercing, PreparedSurface,
56    intersect_curve_surface, touch_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 extrusion::{crosses_extrusion_rim, plane_extrusion_at_rims};
66pub use march::{
67    Contact, Marching, Stopped, Traced, branches, branches_cut_at_poles, cut_at_poles,
68    passes_a_pole, seeds, trace,
69};
70pub use section::{
71    IntersectOptions, ParameterWindow, SectionCurve, SurfaceIntersection, exact_pcurve_of,
72    exact_pcurve_over, intersect_surfaces, intersect_surfaces_within,
73};
74pub use surface::{Meeting, drum_onto_plane, surface_surface};
75pub use walk::{Condition, Walked, follow, walk_one_way};