Skip to main content

curve_could_contain

Function curve_could_contain 

Source
pub fn curve_could_contain<const D: usize, const C: usize>(
    curve: &NurbCurve<D>,
    point: &Vector<C>,
    max_nodes: usize,
    min_subdivision_size: Scalar,
) -> GeopResult<Option<Scalar>>
Expand description

Every parameter at which curve could pass through point: the Scalar::union of every converged segment’s clipped parameter interval, exploring breadth-first up to max_nodes segments. None only when every part of the domain was rejected: running out of budget is never read as “not contained” (nor as “contained”) — it is an error, since the search is incomplete (see surface.md §5).

Each segment is clipped (see [clip]). An empty clip rejects it. While the clip keeps shrinking the segment it is restricted and clipped again ([restriction]). Once it stalls — several solutions or a tangency in one segment, or the resolution of the data reached — the segment is reported with its clipped interval (tighter than its domain, and still an enclosure) if it has converged, and bisected otherwise ([stalled]). min_subdivision_size thus only decides when to stop bisecting: a segment that clipping keeps shrinking is never cut short, so a point merely within min_subdivision_size of the curve is still rejected.

Restriction cuts at the clip’s outer bounds (Scalar::lower / Scalar::upper), which are free choices only on the outside: any cut outside the enclosure loses nothing, a cut through it would. Bisection uses the sharpened midpoint as always.