Function kurbo::common::solve_quadratic

source ·
pub fn solve_quadratic(c0: f64, c1: f64, c2: f64) -> ArrayVec<f64, 2>
Expand description

Find real roots of quadratic equation.

Return values of x for which c0 + c1 x + c2 x² = 0.

This function tries to be quite numerically robust. If the equation is nearly linear, it will return the root ignoring the quadratic term; the other root might be out of representable range. In the degenerate case where all coefficients are zero, so that all values of x satisfy the equation, a single 0.0 is returned.