);
Given a cubic polynomial in the form of a three- or four-element vector coeffs, cv::solveCubic()
will compute the real roots of that polynomial. If coeffs has four elements, the roots of the following
polynomial are computed:
The results are stored in the array roots, which will have either one or three elements, depending on how
may real roots the polynomial has.
A word of warning about cv::solveCubic() and cv::solvePoly(): the order
of the coefficients in the seemingly analogous input arrays coeffs is opposite in the
two routines. In cv::solveCubic(), the highest order coefficients come first, while
in cv::solvePoly() the highest order coefficients come last.
cv::solvePoly()
int cv::solvePoly (
cv::InputArray coeffs,
cv::OutputArray roots // n complex roots (2-channels)
int maxIters = 300 // maximum iterations for solver
);
Given a polynomial of any order in the form of a vector of coefficients coeffs, cv::solvePoly()
will attempt to compute the roots of that polynomial. Given the array of coefficients coeffs, the roots of
the following polynomial are computed: