Skip to main content

min_dist_param

Function min_dist_param 

Source
pub(crate) fn min_dist_param(
    bez1: &[Vec2],
    bez2: &[Vec2],
    u: (f64, f64),
    v: (f64, f64),
    epsilon: f64,
    best_alpha: Option<f64>,
) -> (f64, f64, f64)
Expand description

Given the control points of n- and m-dimensional Bézier curves in bez1 and bez2 respectively, calculate the minimum distance between the two curves.

This should work for arbitrary Bézier curves up to and including degree 255, but only lines, quadratics and cubics are tested.

Returns a tuple of the distance, the path time t1 of the closest point on the first Bézier, and the path time t2 of the closest point on the second Bézier.

§Panics

This panics if more than 256 control points are given in bez1 or bez2, i.e., if either Bézier is of degree greater than 255.