Skip to main content

curve_curve_crossings

Function curve_curve_crossings 

Source
pub fn curve_curve_crossings<S: Scalar, const D: usize, const C: usize>(
    curve_a: &NurbCurve<S, D>,
    curve_b: &NurbCurve<S, D>,
    max_nodes: usize,
    min_subdivision_size: S,
) -> GeopResult<Vec<(S, S)>>
where NurbCurve<S, D>: ParameterRefinable<S, C>,
Expand description

All (s, t) with curve_a(s) = curve_b(t), as paired parameter boxes (curve_curve.md), for curves that do not overlap along an arc — see curve_curve_intersect for the wrapper that handles overlaps. Breadth-first over pairs of subcurves:

  • the cached AABBs and the [clip] are necessary conditions — failing either rejects the pair;
  • a pair converges once both segments’ extents are within min_subdivision_size ([crate::fat_line::converged]), and reports its segments’ domains — a candidate, not an existence proof;
  • if one parameter is pinned onto a clamped end, the other curve is searched for that endpoint with curve_could_contain;
  • otherwise both curves are restricted to the clip, or one is bisected, per [crate::fat_line::plan]. Rebuilding the coefficients after a restriction is what couples the directions: clipping t shrinks the rows unioned for s.

Boxes that overlap are merged by union into one unresolved cluster (DisjointSet), never averaged. Exhausting max_nodes is an error — the result would be incomplete, and neither “empty” nor “coincident” may be read into it.