Skip to main content

curve_could_contain

Function curve_could_contain 

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

Fat-line-clipping counterpart of super::curve_bisect::curve_could_contain, with the same tunables: 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: unlike curve_bisect, 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. A segment converges — and reports its clipped interval, tighter than its domain and still an enclosure — once either the curve evaluated over that interval contains the point within min_subdivision_size in every axis, or its chord is no longer definitely greater than min_subdivision_size. Otherwise, if the clip removed at least 20% of the domain, the segment is restricted to the clip and clipped again; if it didn’t — several solutions in one segment, or a tangency, where clipping stalls — it is bisected instead, exactly as the hull search always does. (20% is the usual Bézier/fat line clipping rule, Sederberg & Nishita.)

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.