nearest_t

Function nearest_t 

Source
pub fn nearest_t<F>(
    p: Vector2<f32>,
    f: F,
    t_range: RangeInclusive<f32>,
    options: NearestOptions,
) -> NearestResult
where F: Fn(f32) -> Vector2<f32> + Copy,
Expand description

Find nearest parameter t to point p on curve f(t) over t_range.

  • Uses multi-start local minimization of the squared distance seeded by uniform sampling. This is robust for most curves without requiring derivatives. If you have an analytic derivative, consider nearest_t_with_derivative for potentially faster convergence.
  • Returns NearestResult with the closest point and (signed) distance.