Skip to main content

calc_segment_point_u

Function calc_segment_point_u 

Source
pub fn calc_segment_point_u(
    x1: f64,
    y1: f64,
    x2: f64,
    y2: f64,
    x: f64,
    y: f64,
) -> f64
Expand description

Compute the parameter u for the projection of point (x, y) onto the line segment (x1,y1)→(x2,y2). Returns 0 if the segment is degenerate.