Skip to main content

curve_curve_crossings

Function curve_curve_crossings 

Source
pub fn curve_curve_crossings<const D: usize, const C: usize>(
    curve_a: &NurbCurve<D>,
    curve_b: &NurbCurve<D>,
    max_nodes: usize,
    min_subdivision_size: Scalar,
) -> GeopResult<Vec<(Scalar, Scalar)>>
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;
  • if one parameter is pinned onto a clamped end, the other curve is searched for that endpoint with curve_could_contain;
  • while the clip keeps shrinking the pair, both curves are restricted to it ([crate::fat_line::restriction]). Rebuilding the coefficients after a restriction is what couples the directions: clipping t shrinks the rows unioned for s;
  • once clipping stalls ([crate::fat_line::stalled]), a pair whose segments’ extents are both within min_subdivision_size has converged and reports its segments’ domains — a candidate, not an existence proof; any other has one curve bisected. min_subdivision_size thus bounds only bisection, never a pair clipping is still shrinking.

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.