[base] Add extra tests for cubic and quadratic root solving
This originally started as an attempt to unify the PathOps
and base root-finding algorithms [1], however that was abandoned
due to precision-sensitive code in PathOps.
While doing that, I found some cases that caused asserts because
sk_doubles_nearly_equal_ulps was used with two very small numbers
(which it Units of Least Precision are not the accurate choice
to differentiate). This inspired me to add a few more tests and
a simple fuzzer for the new code.
I initially tried to make the fuzzer verify the roots were correct,
however due to floating point imprecisions, this was an infeasible
game of whack-a-float. At least we can assert we do only return
finite numbers, the roots are unique, and for the case of the
ValidT roots, only roots in the range [0, 1].
CubicMapTest doesn't need the PathOps version of the root solver,
so I changed it to use the base version.
Change-Id: Ic5a190fe16a54046319da4946a95b5e4c1df6ba6
Bug: skia:13983, skia:14063
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/633476
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
14 files changed