summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorSvenn-Arne Dragly <svenn-arne.dragly@qt.io>2018-03-13 17:35:26 +0100
committerSvenn-Arne Dragly <svenn-arne.dragly@qt.io>2018-03-25 18:13:47 +0000
commitc5a6d31c2a40a3e1bd976ff8162238a7cbc066b4 (patch)
treef4e88d603ad0433a510f160e018ffa764824f3ad /src/render
parent2bf1f907e9e6ac87fc039d674eaca5179c5029f6 (diff)
Fix findCubicRoots for cases where coefficients are close to zero
The equation is a*x^3 + b*x^2 + c*x + d = 0. Previously, we would divide by zero if a = ~0. This change also makes sure that we return zero no roots in the case where a = ~0 and c*c - 4*b*d < 0, and the case where a = b = c = ~0. Finally, we return 0 or 1 if we're close enough to assume that it could be a numerical error. This change also adds tests for the above cases. Change-Id: I426d2fc6175b3aff6fe099845bf63d433c158536 Co-authored-by: Christian Strømme <christian.stromme@qt.io> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/render')
0 files changed, 0 insertions, 0 deletions