Prebuilt module for commit 90bc4ffecb

This commit is contained in:
Paper.js Bot 2016-07-07 04:41:59 +00:00
parent 3a7081cafa
commit 5a42baab74
5 changed files with 157 additions and 61 deletions

View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Thu Jul 7 06:21:20 2016 +0200
* Date: Thu Jul 7 06:39:28 2016 +0200
*
***
*
@ -972,6 +972,25 @@ var Numerical = new function() {
return value < min ? min : value > max ? max : value;
}
function splitDouble(X) {
var bigX = X * 134217729,
Y = X - bigX,
Xh = Y + bigX;
return [Xh, X - Xh];
}
function higherPrecisionDiscriminant(a, b, c) {
var ad = splitDouble(a),
bd = splitDouble(b),
cd = splitDouble(c),
p = b * b,
dp = (bd[0] * bd[0] - p + 2 * bd[0] * bd[1]) + bd[1] * bd[1],
q = a * c,
dq = (ad[0] * cd[0] - q + ad[0] * cd[1] + ad[1] * cd[0])
+ ad[1] * cd[1];
return (p - q) + (dp - dq);
}
return {
TOLERANCE: 1e-6,
EPSILON: EPSILON,
@ -1028,18 +1047,24 @@ var Numerical = new function() {
eMax = max + EPSILON,
x1, x2 = Infinity,
B = b,
D;
D, E, pi = 3;
b /= -2;
D = b * b - a * c;
E = b * b + a * c;
if (pi * abs(D) < E) {
D = higherPrecisionDiscriminant(a, b, c);
}
if (D !== 0 && abs(D) < MACHINE_EPSILON) {
var gmC = pow(abs(a * b * c), 1 / 3);
if (gmC < 1e-8) {
var mult = gmC === 0 ? 0 : pow(10,
abs(Math.floor(Math.log(gmC) * Math.LOG10E)));
a *= mult;
b *= mult;
c *= mult;
D = b * b - a * c;
var sc = (abs(a) + abs(b) + abs(c)) || MACHINE_EPSILON;
sc = pow(2, -Math.floor(Math.log(sc) * Math.LOG2E + 0.5));
a *= sc;
b *= sc;
c *= sc;
D = b * b - a * c;
E = b * b + a * c;
B = - 2.0 * b;
if (pi * abs(D) < E) {
D = higherPrecisionDiscriminant(a, b, c);
}
}
if (abs(a) < EPSILON) {
@ -1066,8 +1091,15 @@ var Numerical = new function() {
},
solveCubic: function(a, b, c, d, roots, min, max) {
var count = 0,
x, b1, c2;
var count = 0, x, b1, c2,
s = Math.max(abs(a), abs(b), abs(c), abs(d));
if ((s < 1e-7 && s > 0) || s > 1e7) {
var p = pow(2, -Math.floor(Math.log(s) * Math.LOG2E));
a *= p;
b *= p;
c *= p;
d *= p;
}
if (abs(a) < EPSILON) {
a = b;
b1 = c;
@ -1090,7 +1122,7 @@ var Numerical = new function() {
r = pow(abs(t), 1/3);
s = t < 0 ? -1 : 1;
t = -qd / a;
r = t > 0 ? 1.3247179572 * Math.max(r, sqrt(t)) : r;
r = t > 0 ? 1.324717957244746 * Math.max(r, sqrt(t)) : r;
x0 = x - s * r;
if (x0 !== x) {
do {
@ -1109,8 +1141,8 @@ var Numerical = new function() {
}
}
var count = Numerical.solveQuadratic(a, b1, c2, roots, min, max);
if (isFinite(x) && count >= 0
&& (count === 0 || x !== roots[count - 1])
if (isFinite(x) && (count === 0
|| count > 0 && x !== roots[0] && x !== roots[1])
&& (min == null || x > min - EPSILON && x < max + EPSILON))
roots[count++] = min == null ? x : clamp(x, min, max);
return count;

62
dist/paper-core.js vendored
View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Thu Jul 7 06:21:20 2016 +0200
* Date: Thu Jul 7 06:39:28 2016 +0200
*
***
*
@ -972,6 +972,25 @@ var Numerical = new function() {
return value < min ? min : value > max ? max : value;
}
function splitDouble(X) {
var bigX = X * 134217729,
Y = X - bigX,
Xh = Y + bigX;
return [Xh, X - Xh];
}
function higherPrecisionDiscriminant(a, b, c) {
var ad = splitDouble(a),
bd = splitDouble(b),
cd = splitDouble(c),
p = b * b,
dp = (bd[0] * bd[0] - p + 2 * bd[0] * bd[1]) + bd[1] * bd[1],
q = a * c,
dq = (ad[0] * cd[0] - q + ad[0] * cd[1] + ad[1] * cd[0])
+ ad[1] * cd[1];
return (p - q) + (dp - dq);
}
return {
TOLERANCE: 1e-6,
EPSILON: EPSILON,
@ -1028,18 +1047,24 @@ var Numerical = new function() {
eMax = max + EPSILON,
x1, x2 = Infinity,
B = b,
D;
D, E, pi = 3;
b /= -2;
D = b * b - a * c;
E = b * b + a * c;
if (pi * abs(D) < E) {
D = higherPrecisionDiscriminant(a, b, c);
}
if (D !== 0 && abs(D) < MACHINE_EPSILON) {
var gmC = pow(abs(a * b * c), 1 / 3);
if (gmC < 1e-8) {
var mult = gmC === 0 ? 0 : pow(10,
abs(Math.floor(Math.log(gmC) * Math.LOG10E)));
a *= mult;
b *= mult;
c *= mult;
D = b * b - a * c;
var sc = (abs(a) + abs(b) + abs(c)) || MACHINE_EPSILON;
sc = pow(2, -Math.floor(Math.log(sc) * Math.LOG2E + 0.5));
a *= sc;
b *= sc;
c *= sc;
D = b * b - a * c;
E = b * b + a * c;
B = - 2.0 * b;
if (pi * abs(D) < E) {
D = higherPrecisionDiscriminant(a, b, c);
}
}
if (abs(a) < EPSILON) {
@ -1066,8 +1091,15 @@ var Numerical = new function() {
},
solveCubic: function(a, b, c, d, roots, min, max) {
var count = 0,
x, b1, c2;
var count = 0, x, b1, c2,
s = Math.max(abs(a), abs(b), abs(c), abs(d));
if ((s < 1e-7 && s > 0) || s > 1e7) {
var p = pow(2, -Math.floor(Math.log(s) * Math.LOG2E));
a *= p;
b *= p;
c *= p;
d *= p;
}
if (abs(a) < EPSILON) {
a = b;
b1 = c;
@ -1090,7 +1122,7 @@ var Numerical = new function() {
r = pow(abs(t), 1/3);
s = t < 0 ? -1 : 1;
t = -qd / a;
r = t > 0 ? 1.3247179572 * Math.max(r, sqrt(t)) : r;
r = t > 0 ? 1.324717957244746 * Math.max(r, sqrt(t)) : r;
x0 = x - s * r;
if (x0 !== x) {
do {
@ -1109,8 +1141,8 @@ var Numerical = new function() {
}
}
var count = Numerical.solveQuadratic(a, b1, c2, roots, min, max);
if (isFinite(x) && count >= 0
&& (count === 0 || x !== roots[count - 1])
if (isFinite(x) && (count === 0
|| count > 0 && x !== roots[0] && x !== roots[1])
&& (min == null || x > min - EPSILON && x < max + EPSILON))
roots[count++] = min == null ? x : clamp(x, min, max);
return count;

File diff suppressed because one or more lines are too long

62
dist/paper-full.js vendored
View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Thu Jul 7 06:21:20 2016 +0200
* Date: Thu Jul 7 06:39:28 2016 +0200
*
***
*
@ -972,6 +972,25 @@ var Numerical = new function() {
return value < min ? min : value > max ? max : value;
}
function splitDouble(X) {
var bigX = X * 134217729,
Y = X - bigX,
Xh = Y + bigX;
return [Xh, X - Xh];
}
function higherPrecisionDiscriminant(a, b, c) {
var ad = splitDouble(a),
bd = splitDouble(b),
cd = splitDouble(c),
p = b * b,
dp = (bd[0] * bd[0] - p + 2 * bd[0] * bd[1]) + bd[1] * bd[1],
q = a * c,
dq = (ad[0] * cd[0] - q + ad[0] * cd[1] + ad[1] * cd[0])
+ ad[1] * cd[1];
return (p - q) + (dp - dq);
}
return {
TOLERANCE: 1e-6,
EPSILON: EPSILON,
@ -1028,18 +1047,24 @@ var Numerical = new function() {
eMax = max + EPSILON,
x1, x2 = Infinity,
B = b,
D;
D, E, pi = 3;
b /= -2;
D = b * b - a * c;
E = b * b + a * c;
if (pi * abs(D) < E) {
D = higherPrecisionDiscriminant(a, b, c);
}
if (D !== 0 && abs(D) < MACHINE_EPSILON) {
var gmC = pow(abs(a * b * c), 1 / 3);
if (gmC < 1e-8) {
var mult = gmC === 0 ? 0 : pow(10,
abs(Math.floor(Math.log(gmC) * Math.LOG10E)));
a *= mult;
b *= mult;
c *= mult;
D = b * b - a * c;
var sc = (abs(a) + abs(b) + abs(c)) || MACHINE_EPSILON;
sc = pow(2, -Math.floor(Math.log(sc) * Math.LOG2E + 0.5));
a *= sc;
b *= sc;
c *= sc;
D = b * b - a * c;
E = b * b + a * c;
B = - 2.0 * b;
if (pi * abs(D) < E) {
D = higherPrecisionDiscriminant(a, b, c);
}
}
if (abs(a) < EPSILON) {
@ -1066,8 +1091,15 @@ var Numerical = new function() {
},
solveCubic: function(a, b, c, d, roots, min, max) {
var count = 0,
x, b1, c2;
var count = 0, x, b1, c2,
s = Math.max(abs(a), abs(b), abs(c), abs(d));
if ((s < 1e-7 && s > 0) || s > 1e7) {
var p = pow(2, -Math.floor(Math.log(s) * Math.LOG2E));
a *= p;
b *= p;
c *= p;
d *= p;
}
if (abs(a) < EPSILON) {
a = b;
b1 = c;
@ -1090,7 +1122,7 @@ var Numerical = new function() {
r = pow(abs(t), 1/3);
s = t < 0 ? -1 : 1;
t = -qd / a;
r = t > 0 ? 1.3247179572 * Math.max(r, sqrt(t)) : r;
r = t > 0 ? 1.324717957244746 * Math.max(r, sqrt(t)) : r;
x0 = x - s * r;
if (x0 !== x) {
do {
@ -1109,8 +1141,8 @@ var Numerical = new function() {
}
}
var count = Numerical.solveQuadratic(a, b1, c2, roots, min, max);
if (isFinite(x) && count >= 0
&& (count === 0 || x !== roots[count - 1])
if (isFinite(x) && (count === 0
|| count > 0 && x !== roots[0] && x !== roots[1])
&& (min == null || x > min - EPSILON && x < max + EPSILON))
roots[count++] = min == null ? x : clamp(x, min, max);
return count;

File diff suppressed because one or more lines are too long