Skip to main content

project_on_curve

Function project_on_curve 

Source
pub fn project_on_curve(
    curve: &Curve,
    target: Point,
    samples: usize,
    tol: Tolerances,
) -> OgeomResult<Projection>
Expand description

The nearest point on a curve to target.

Samples the domain to bracket the minimum, then refines. The sampling is not decoration: the distance function along a curve is generally multi-modal (a point inside a circle is equidistant from every part of it, and a point near a spline’s inflection has two competing minima), so starting a local method from one guess finds whichever basin it happens to land in. The sample count sets how fine a feature can be resolved, and is stated rather than hidden.

§Errors

OgeomError::Domain if the curve cannot be evaluated over its own domain.