Numeric intersections report their completeness
A numeric intersection returns its hits together with a completeness status, in the way an exact intersection reports "not analytic" instead of guessing. The status is complete when the search proved that no other hit exists. This happens on the subdivision of B-spline pieces when every pair was proven apart or shrunk to at most one hit. It is incomplete when the search left pairs unsettled: it says why (the budget of halvings ran out, or pieces never separated at a tangent contact, an overlap or a singular point) and the regions where hits may be missing, as parameter ranges on both shapes and a box in space. It is sampled when the hits come from samples, as for every pair without a B-spline: such a search can miss a hit anywhere, and saying so is the only honest status it has. An incomplete search still returns the hits it proved, together with those of the sampled search that do not merge into them, so a caller that only wants hits gets at least what it got before, and a caller that must not miss one knows where to look. The result reads as the slice of its hits, so code that ignores the status keeps working.
The numeric curve–curve intersection and extrema report the same status, with regions holding a parameter range on each curve and a box in space. For the extrema a local minimum of the distance stands for a hit: the search is complete when every pair of pieces was proven to hold no minimum or was solved. A straight overlap, where both pieces run along one line within tolerance, never separates. Amended by ADR 0034: a tangent contact between two curves, where they stay within tolerance of each other and then part, is one hit and stays complete. The curve–surface search is unchanged by it. A valley of equal distance (concentric arcs, an overlap along a curved stretch) runs out of budget. An incomplete intersection adds the sampled hits as above, and incomplete extrema add the sampled grid's seeds, the minima reached from both merged into one per valley. Every other pair is sampled, two straight curves solved in closed form included, so that only the subdivision search ever claims completeness.
An elementary shape intersected with a B-spline goes through the same search, converted to its exact rational B-spline, so mixed intersections report complete or incomplete like two B-splines. Every hit lies on the B-spline, so within the box of its control points: a shape without bounds (a line, parabola, hyperbola, plane, cylinder or cone) is converted over the part inside that box grown by a margin, which loses no hit. The B-spline's parameter is carried back to the shape's own before the hits are reported. For the extrema only a segment goes through the search: against a curved elementary curve or a full line the grid is faster (about 4 times on a whole ellipse, where the distance has a maximum along the closed curve for every point of the B-spline), and a proven result is not worth a slowdown, so those pairs stay sampled. Two elementary shapes through the numeric entry points stay sampled: no B-spline bounds the search for an unbounded one, and the exact intersections cover them.
Considered options
- An error for an incomplete search (
Result<hits, error>): rejected. A tangent contact or a curve lying on a surface is a valid configuration, not a failure. Most callers still want the hits found, and an error would force every caller to recover them from the error value. - Complete or incomplete only, with sampled results counted as incomplete: rejected. Incomplete promises regions where hits may be missing; a sampled search has none to give, since a hit between samples can lie anywhere. A separate status keeps that promise checkable.
- Returning only the proven hits when the search is incomplete: rejected. At a tangent contact or an overlap the subdivision finds few hits or none, while the sampled search finds the contact. Dropping those hits would make the result worse than before for every caller that ignores the status.
- A status per hit: rejected. Completeness is a property of the search, not of a hit: the hits found are all verified on both shapes, and what may be missing is a hit that was never found.
Amended (#330): a numeric curve–surface or curve–curve intersection whose regions all lie in the overlaps it joined reports Unseparated, even where the subdivision ran out of halvings along a curved overlap. The status names what a caller can act on, and no budget would separate an overlap. Where pieces beside the overlaps are left unsettled, the reason stays BudgetExhausted. Two bounded surfaces whose boxes are apart now give an empty Complete result, where the march returned Sampled: the boxes prove they do not meet. The boxes of the control points are checked before the march. The tight boxes, which cost a few hundred evaluations, are checked after a march that found nothing.
Amended (#311): a marched curve whose measured deviation exceeds the confusion makes the result Incomplete with the reason LooseFit, its regions holding each such curve (its ranges in both surfaces' parameters and its box). A caller asked for curves within the confusion and must not get one farther off with no sign of it. It is the weakest reason, after Unseparated: the curve was found, only fitted looser than asked, while the other reasons say a hit may be missing. As with Unbounded, the march is as sampled as before outside the regions. The status is about the search, but deviation is already per curve, so a caller that wants to know which curves are loose reads it; the reason only makes the result say so without reading every curve. Considered: a new status beside Incomplete, rejected because it would break every match on Completeness for a case that fits the existing one, regions and all; and a flag on the curve, rejected because deviation already is that flag and was missed by callers that read only the status. The flag waited on the fits in parameters being bounded (#393), and the boundary curves lying on the other surface being sampled for their fits in parameters too (ADR 0052): before that, about 360 curves across the test suite were over the confusion, most of them ordinary cuts, and the reason would have been on many ordinary results. What remains is rare and explained: a surface's parameters degenerate on the curve (a sphere's pole, an extrusion's fold), their rounding is coarser than the confusion (a B-spline whose knots crowd a long stretch into a tiny span), the last short step onto a patch's boundary, and touches, whose curves interpolate points found only to within confusion.