Skip to main content

project_on_surface_from

Function project_on_surface_from 

Source
pub fn project_on_surface_from(
    surface: &SurfaceGeometry,
    target: Point,
    guess: (f64, f64),
    tol: Tolerances,
) -> OgeomResult<SurfaceProjection>
Expand description

The nearest point on a surface to target, starting from a guess.

project_on_surface brackets with a grid before refining. A caller walking along something (the samples of a curve being projected into a chart) already has a far better guess than any grid: where the previous sample landed. Neighbouring samples of a curve are neighbouring points of the surface, so the refinement starts inside the right basin and converges in a few steps, and the grid’s hundreds of evaluations per sample are not spent at all.

The guess is load-bearing: this converges on the foot point nearest it, not on the globally nearest one. A caller that cannot vouch for its guess should check the reported distance and fall back to project_on_surface, which is what the exchange readers do.

§Errors

As project_on_surface.