mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Rename nRoots to count.
This commit is contained in:
parent
22be259167
commit
55e2f6610a
1 changed files with 10 additions and 10 deletions
|
@ -173,7 +173,7 @@ var Numerical = new function() {
|
||||||
* @author Harikrishnan Gopalakrishnan
|
* @author Harikrishnan Gopalakrishnan
|
||||||
*/
|
*/
|
||||||
solveQuadratic: function(a, b, c, roots, min, max) {
|
solveQuadratic: function(a, b, c, roots, min, max) {
|
||||||
var nRoots = 0,
|
var count = 0,
|
||||||
x1, x2 = Infinity,
|
x1, x2 = Infinity,
|
||||||
B = b,
|
B = b,
|
||||||
D;
|
D;
|
||||||
|
@ -225,15 +225,15 @@ var Numerical = new function() {
|
||||||
x2 = c / q;
|
x2 = c / q;
|
||||||
}
|
}
|
||||||
// Do we actually have two real roots?
|
// Do we actually have two real roots?
|
||||||
// nRoots = D > MACHINE_EPSILON ? 2 : 1;
|
// count = D > MACHINE_EPSILON ? 2 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isFinite(x1) && (min == null || x1 >= min && x1 <= max))
|
if (isFinite(x1) && (min == null || x1 >= min && x1 <= max))
|
||||||
roots[nRoots++] = x1;
|
roots[count++] = x1;
|
||||||
if (x2 !== x1
|
if (x2 !== x1
|
||||||
&& isFinite(x2) && (min == null || x2 >= min && x2 <= max))
|
&& isFinite(x2) && (min == null || x2 >= min && x2 <= max))
|
||||||
roots[nRoots++] = x2;
|
roots[count++] = x2;
|
||||||
return nRoots;
|
return count;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -264,7 +264,7 @@ var Numerical = new function() {
|
||||||
* @author Harikrishnan Gopalakrishnan
|
* @author Harikrishnan Gopalakrishnan
|
||||||
*/
|
*/
|
||||||
solveCubic: function(a, b, c, d, roots, min, max) {
|
solveCubic: function(a, b, c, d, roots, min, max) {
|
||||||
var x, b1, c2, nRoots = 0;
|
var x, b1, c2, count = 0;
|
||||||
// If a or d is zero, we only need to solve a quadratic, so we set
|
// If a or d is zero, we only need to solve a quadratic, so we set
|
||||||
// the coefficients appropriately.
|
// the coefficients appropriately.
|
||||||
if (a === 0) {
|
if (a === 0) {
|
||||||
|
@ -322,11 +322,11 @@ var Numerical = new function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The cubic has been deflated to a quadratic.
|
// The cubic has been deflated to a quadratic.
|
||||||
var nRoots = Numerical.solveQuadratic(a, b1, c2, roots, min, max);
|
var count = Numerical.solveQuadratic(a, b1, c2, roots, min, max);
|
||||||
if (isFinite(x) && (nRoots === 0 || x !== roots[nRoots - 1])
|
if (isFinite(x) && (count === 0 || x !== roots[count - 1])
|
||||||
&& (min == null || x >= min && x <= max))
|
&& (min == null || x >= min && x <= max))
|
||||||
roots[nRoots++] = x;
|
roots[count++] = x;
|
||||||
return nRoots;
|
return count;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue