mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Prebuilt module for commit da78e837a1
This commit is contained in:
parent
16cd46fcbd
commit
404ae88f82
5 changed files with 88 additions and 94 deletions
50
dist/docs/assets/js/paper.js
vendored
50
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Sat Jul 9 13:28:50 2016 +0200
|
||||
* Date: Sat Jul 9 13:54:02 2016 +0200
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -1001,9 +1001,9 @@ var Numerical = new function() {
|
|||
}
|
||||
|
||||
function getNormalizationFactor() {
|
||||
var max = Math.max.apply(Math, arguments);
|
||||
return max && (max < 1e-8 || max > 1e8)
|
||||
? pow(2, -Math.round(log2(max)))
|
||||
var norm = Math.max.apply(Math, arguments);
|
||||
return norm && (norm < 1e-8 || norm > 1e8)
|
||||
? pow(2, -Math.round(log2(norm)))
|
||||
: 0;
|
||||
}
|
||||
|
||||
|
@ -1101,13 +1101,23 @@ var Numerical = new function() {
|
|||
|
||||
solveCubic: function(a, b, c, d, roots, min, max) {
|
||||
var f = getNormalizationFactor(abs(a), abs(b), abs(c), abs(d)),
|
||||
x, b1, c2;
|
||||
x, b1, c2, qd, q;
|
||||
if (f) {
|
||||
a *= f;
|
||||
b *= f;
|
||||
c *= f;
|
||||
d *= f;
|
||||
}
|
||||
|
||||
function evaluate(x0) {
|
||||
x = x0;
|
||||
var tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
}
|
||||
|
||||
if (abs(a) < EPSILON) {
|
||||
a = b;
|
||||
b1 = c;
|
||||
|
@ -1118,29 +1128,17 @@ var Numerical = new function() {
|
|||
c2 = c;
|
||||
x = 0;
|
||||
} else {
|
||||
var ec = 1 + MACHINE_EPSILON,
|
||||
x0, q, qd, t, r, s, tmp;
|
||||
x = -(b / a) / 3;
|
||||
tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
t = q / a;
|
||||
r = pow(abs(t), 1/3);
|
||||
s = t < 0 ? -1 : 1;
|
||||
t = -qd / a;
|
||||
r = t > 0 ? 1.324717957244746 * Math.max(r, sqrt(t)) : r;
|
||||
x0 = x - s * r;
|
||||
evaluate(-(b / a) / 3);
|
||||
var t = q / a,
|
||||
r = pow(abs(t), 1/3),
|
||||
s = t < 0 ? -1 : 1,
|
||||
td = -qd / a,
|
||||
rd = td > 0 ? 1.324717957244746 * Math.max(r, sqrt(td)) : r,
|
||||
x0 = x - s * rd;
|
||||
if (x0 !== x) {
|
||||
do {
|
||||
x = x0;
|
||||
tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
x0 = qd === 0 ? x : x - q / qd / ec;
|
||||
evaluate(x0);
|
||||
x0 = qd === 0 ? x : x - q / qd / (1 + MACHINE_EPSILON);
|
||||
} while (s * x0 > s * x);
|
||||
if (abs(a) * x * x > abs(d / x)) {
|
||||
c2 = -d / x;
|
||||
|
|
50
dist/paper-core.js
vendored
50
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Sat Jul 9 13:28:50 2016 +0200
|
||||
* Date: Sat Jul 9 13:54:02 2016 +0200
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -1001,9 +1001,9 @@ var Numerical = new function() {
|
|||
}
|
||||
|
||||
function getNormalizationFactor() {
|
||||
var max = Math.max.apply(Math, arguments);
|
||||
return max && (max < 1e-8 || max > 1e8)
|
||||
? pow(2, -Math.round(log2(max)))
|
||||
var norm = Math.max.apply(Math, arguments);
|
||||
return norm && (norm < 1e-8 || norm > 1e8)
|
||||
? pow(2, -Math.round(log2(norm)))
|
||||
: 0;
|
||||
}
|
||||
|
||||
|
@ -1101,13 +1101,23 @@ var Numerical = new function() {
|
|||
|
||||
solveCubic: function(a, b, c, d, roots, min, max) {
|
||||
var f = getNormalizationFactor(abs(a), abs(b), abs(c), abs(d)),
|
||||
x, b1, c2;
|
||||
x, b1, c2, qd, q;
|
||||
if (f) {
|
||||
a *= f;
|
||||
b *= f;
|
||||
c *= f;
|
||||
d *= f;
|
||||
}
|
||||
|
||||
function evaluate(x0) {
|
||||
x = x0;
|
||||
var tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
}
|
||||
|
||||
if (abs(a) < EPSILON) {
|
||||
a = b;
|
||||
b1 = c;
|
||||
|
@ -1118,29 +1128,17 @@ var Numerical = new function() {
|
|||
c2 = c;
|
||||
x = 0;
|
||||
} else {
|
||||
var ec = 1 + MACHINE_EPSILON,
|
||||
x0, q, qd, t, r, s, tmp;
|
||||
x = -(b / a) / 3;
|
||||
tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
t = q / a;
|
||||
r = pow(abs(t), 1/3);
|
||||
s = t < 0 ? -1 : 1;
|
||||
t = -qd / a;
|
||||
r = t > 0 ? 1.324717957244746 * Math.max(r, sqrt(t)) : r;
|
||||
x0 = x - s * r;
|
||||
evaluate(-(b / a) / 3);
|
||||
var t = q / a,
|
||||
r = pow(abs(t), 1/3),
|
||||
s = t < 0 ? -1 : 1,
|
||||
td = -qd / a,
|
||||
rd = td > 0 ? 1.324717957244746 * Math.max(r, sqrt(td)) : r,
|
||||
x0 = x - s * rd;
|
||||
if (x0 !== x) {
|
||||
do {
|
||||
x = x0;
|
||||
tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
x0 = qd === 0 ? x : x - q / qd / ec;
|
||||
evaluate(x0);
|
||||
x0 = qd === 0 ? x : x - q / qd / (1 + MACHINE_EPSILON);
|
||||
} while (s * x0 > s * x);
|
||||
if (abs(a) * x * x > abs(d / x)) {
|
||||
c2 = -d / x;
|
||||
|
|
16
dist/paper-core.min.js
vendored
16
dist/paper-core.min.js
vendored
File diff suppressed because one or more lines are too long
50
dist/paper-full.js
vendored
50
dist/paper-full.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Sat Jul 9 13:28:50 2016 +0200
|
||||
* Date: Sat Jul 9 13:54:02 2016 +0200
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -1001,9 +1001,9 @@ var Numerical = new function() {
|
|||
}
|
||||
|
||||
function getNormalizationFactor() {
|
||||
var max = Math.max.apply(Math, arguments);
|
||||
return max && (max < 1e-8 || max > 1e8)
|
||||
? pow(2, -Math.round(log2(max)))
|
||||
var norm = Math.max.apply(Math, arguments);
|
||||
return norm && (norm < 1e-8 || norm > 1e8)
|
||||
? pow(2, -Math.round(log2(norm)))
|
||||
: 0;
|
||||
}
|
||||
|
||||
|
@ -1101,13 +1101,23 @@ var Numerical = new function() {
|
|||
|
||||
solveCubic: function(a, b, c, d, roots, min, max) {
|
||||
var f = getNormalizationFactor(abs(a), abs(b), abs(c), abs(d)),
|
||||
x, b1, c2;
|
||||
x, b1, c2, qd, q;
|
||||
if (f) {
|
||||
a *= f;
|
||||
b *= f;
|
||||
c *= f;
|
||||
d *= f;
|
||||
}
|
||||
|
||||
function evaluate(x0) {
|
||||
x = x0;
|
||||
var tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
}
|
||||
|
||||
if (abs(a) < EPSILON) {
|
||||
a = b;
|
||||
b1 = c;
|
||||
|
@ -1118,29 +1128,17 @@ var Numerical = new function() {
|
|||
c2 = c;
|
||||
x = 0;
|
||||
} else {
|
||||
var ec = 1 + MACHINE_EPSILON,
|
||||
x0, q, qd, t, r, s, tmp;
|
||||
x = -(b / a) / 3;
|
||||
tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
t = q / a;
|
||||
r = pow(abs(t), 1/3);
|
||||
s = t < 0 ? -1 : 1;
|
||||
t = -qd / a;
|
||||
r = t > 0 ? 1.324717957244746 * Math.max(r, sqrt(t)) : r;
|
||||
x0 = x - s * r;
|
||||
evaluate(-(b / a) / 3);
|
||||
var t = q / a,
|
||||
r = pow(abs(t), 1/3),
|
||||
s = t < 0 ? -1 : 1,
|
||||
td = -qd / a,
|
||||
rd = td > 0 ? 1.324717957244746 * Math.max(r, sqrt(td)) : r,
|
||||
x0 = x - s * rd;
|
||||
if (x0 !== x) {
|
||||
do {
|
||||
x = x0;
|
||||
tmp = a * x;
|
||||
b1 = tmp + b;
|
||||
c2 = b1 * x + c;
|
||||
qd = (tmp + b1) * x + c2;
|
||||
q = c2 * x + d;
|
||||
x0 = qd === 0 ? x : x - q / qd / ec;
|
||||
evaluate(x0);
|
||||
x0 = qd === 0 ? x : x - q / qd / (1 + MACHINE_EPSILON);
|
||||
} while (s * x0 > s * x);
|
||||
if (abs(a) * x * x > abs(d / x)) {
|
||||
c2 = -d / x;
|
||||
|
|
16
dist/paper-full.min.js
vendored
16
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue