Skip to main content

check_numerical_accuracy

Function check_numerical_accuracy 

Source
pub fn check_numerical_accuracy<S: Scalar>(
    _params: &ValidationParameters<S>,
    errors: &mut Vec<GeopError>,
    model: &Model<S>,
)
Expand description

Checks that no stored entity carries more than [MAX_WIDTH] of numerical uncertainty in any coordinate: every vertex position, every edge curve control point, every face surface control point.

Runs before every other check, because it explains them. A too-wide entity does not fail in place — it fails somewhere downstream, as a containment search that finds nothing, a pcurve that will not match its edge, or an intersection that is missed entirely, and the report names that distant symptom rather than the cause.

A failure here almost always means a missing refinement: some operation returned a subdivision search’s raw enclosure (as wide as its tolerance) and stored it, where it should have polished it with Newton first — see NurbCurve::refine_parameter_at_point and intersection::curve_surface::refine_crossing. Widening is monotone through arithmetic, so the first entity to exceed the bound is close to wherever that refinement was skipped.

The same bound doubles as a minimum on how long an edge may be. An edge shorter than the accuracy its own endpoints carry is not a feature of the model, it is noise: nothing can be located along it, the searches cannot tell its two ends apart, and splicing anything into a face across it produces a region of no area. Such an edge always means an operation split something it should have recognised as already coincident.

The placeholder surface a face carries before it is given real geometry (NurbSurface::everything, every coordinate ENTIRE) is deliberately not exempted: a finished model must not contain one, and reporting it here as an unbounded width is exactly right.