Function invert

Source
pub fn invert(
    surface: &Surface,
    point: Point3,
    tolerance: Tolerance,
) -> GeomResult<(Scalar, Scalar)>
Expand description

Surface parameters (u, v) whose evaluation reproduces point.

This is the exact inverse of evaluate for the analytic surfaces, derived from each parameterisation rather than found by iteration, so it neither needs a seed nor converges to a nearby-but-wrong branch.

The point must already lie ON the surface: this answers “which parameters name this point”, not “which point is nearest”. A sweep directrix that has drifted off its reference surface is a modelling error, and silently projecting it would tilt every section frame by an amount nothing downstream can detect. The residual is therefore checked against tolerance and a miss is reported rather than absorbed.

Parameters that no unique answer exists for are refused, not guessed: at a cone apex or a sphere pole the whole u circle maps to one point, so any choice would be arbitrary and would rotate the swept section.