mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Fix to cover the case when Numerical.solveQuadratic return -1 in Numerical.solveCubic
This commit is contained in:
parent
c5b4828ace
commit
ff6484ba8c
1 changed files with 2 additions and 1 deletions
|
@ -356,7 +356,8 @@ var Numerical = new function() {
|
|||
}
|
||||
// The cubic has been deflated to a quadratic.
|
||||
var count = Numerical.solveQuadratic(a, b1, c2, roots, min, max);
|
||||
if (isFinite(x) && (count === 0 || x !== roots[count - 1])
|
||||
if (isFinite(x) && count >= 0
|
||||
&& (count === 0 || x !== roots[count - 1])
|
||||
&& (min == null || x > min - EPSILON && x < max + EPSILON))
|
||||
roots[count++] = min == null ? x : clamp(x, min, max);
|
||||
return count;
|
||||
|
|
Loading…
Reference in a new issue