solveCubic function

(int, Mat) solveCubic(
  1. InputArray coeffs, {
  2. OutputArray? roots,
})

SolveCubic finds the real roots of a cubic equation.

For further details, please see: https://docs.opencv.org/master/d2/de8/group__core__array.html#ga1c3b0b925b085b6e96931ee309e6a1da

Implementation

(int rval, Mat roots) solveCubic(InputArray coeffs, {OutputArray? roots}) {
  roots ??= Mat.empty();
  final rval = cvRunArena<int>((arena) {
    final p = arena<ffi.Int>();
    cvRun(() => cffi.Mat_SolveCubic(coeffs.ref, roots!.ref, p));
    return p.value;
  });
  return (rval, roots);
}