pimath 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pimath.js +424 -424
- package/package.json +1 -1
- package/types/geometry/point.d.ts.map +1 -1
- package/types/geometry/vector.d.ts +1 -0
- package/types/geometry/vector.d.ts.map +1 -1
package/dist/pimath.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var qi = Object.defineProperty;
|
|
2
|
+
var si = (o) => {
|
|
3
3
|
throw TypeError(o);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (o, e, t) =>
|
|
7
|
-
var i = (o, e, t) => (
|
|
8
|
-
function
|
|
9
|
-
const e =
|
|
5
|
+
var Ti = (o, e, t) => e in o ? qi(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
6
|
+
var a = (o, e, t) => Ti(o, typeof e != "symbol" ? e + "" : e, t), Ut = (o, e, t) => e.has(o) || si("Cannot " + t);
|
|
7
|
+
var i = (o, e, t) => (Ut(o, e, "read from private field"), t ? t.call(o) : e.get(o)), d = (o, e, t) => e.has(o) ? si("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), h = (o, e, t, s) => (Ut(o, e, "write to private field"), s ? s.call(o, t) : e.set(o, t), t), M = (o, e, t) => (Ut(o, e, "access private method"), t);
|
|
8
|
+
function Ai(o) {
|
|
9
|
+
const e = ni(o), t = [];
|
|
10
10
|
let s, r;
|
|
11
11
|
for (; e.length > 0; )
|
|
12
12
|
s = e.shift() ?? 1, r = (e.length > 0 ? e.pop() : +s) ?? 1, t.push([s, r]);
|
|
13
13
|
return t;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const e =
|
|
15
|
+
function Mi(...o) {
|
|
16
|
+
const e = _t(...o);
|
|
17
17
|
return o.map((t) => t / e);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function ni(o) {
|
|
20
20
|
const e = Math.abs(o), t = Math.sqrt(e), s = [];
|
|
21
21
|
for (let r = 1; r <= t; r++)
|
|
22
22
|
o % r === 0 && (s.push(r), s.push(e / r));
|
|
@@ -24,7 +24,7 @@ function oi(o) {
|
|
|
24
24
|
return r - n;
|
|
25
25
|
}), [...new Set(s)];
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function _t(...o) {
|
|
28
28
|
const e = function(r, n) {
|
|
29
29
|
return n === 0 ? r : e(n, r % n);
|
|
30
30
|
};
|
|
@@ -39,53 +39,53 @@ function ei(...o) {
|
|
|
39
39
|
;
|
|
40
40
|
return Math.abs(t);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Ii(...o) {
|
|
43
43
|
return o.reduce(function(e, t) {
|
|
44
|
-
return Math.abs(e * t /
|
|
44
|
+
return Math.abs(e * t / _t(e, t));
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Ci(o, e = 3) {
|
|
48
48
|
return +o.toFixed(e);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function $i(o) {
|
|
51
51
|
if (Number.isSafeInteger(o) || o.toString().split(".")[0].length < 10)
|
|
52
52
|
return 0;
|
|
53
53
|
throw new Error("Periodic value: Not implemented yet");
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function Pi(o) {
|
|
56
56
|
const e = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973];
|
|
57
57
|
return o === void 0 ? e : e.slice(0, Math.min(e.length, o));
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Si(o, e) {
|
|
60
60
|
const t = [], s = e === !0 ? +o : o ** 2;
|
|
61
61
|
for (let r = 0; r <= o; r++)
|
|
62
62
|
for (let n = 0; n <= o; n++)
|
|
63
63
|
r ** 2 + n ** 2 === s && t.push([r, n, o]);
|
|
64
64
|
return t;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Bi(o, e = 2) {
|
|
67
67
|
return +`${Math.round(+`${o}e${e}`)}e-${e}`;
|
|
68
68
|
}
|
|
69
69
|
const G = {
|
|
70
|
-
decompose:
|
|
71
|
-
dividers:
|
|
72
|
-
divideNumbersByGCD:
|
|
73
|
-
gcd:
|
|
74
|
-
lcm:
|
|
75
|
-
numberCorrection:
|
|
76
|
-
periodic:
|
|
77
|
-
primes:
|
|
78
|
-
pythagoreanTripletsWithTarget:
|
|
79
|
-
round:
|
|
70
|
+
decompose: Ai,
|
|
71
|
+
dividers: ni,
|
|
72
|
+
divideNumbersByGCD: Mi,
|
|
73
|
+
gcd: _t,
|
|
74
|
+
lcm: Ii,
|
|
75
|
+
numberCorrection: Ci,
|
|
76
|
+
periodic: $i,
|
|
77
|
+
primes: Pi,
|
|
78
|
+
pythagoreanTripletsWithTarget: Si,
|
|
79
|
+
round: Bi
|
|
80
80
|
};
|
|
81
81
|
var w, b, ot, Be;
|
|
82
82
|
const $ = class $ {
|
|
83
83
|
constructor(e, t) {
|
|
84
84
|
// #region Class fields (2)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
d(this, w, 1);
|
|
86
|
+
d(this, b, 1);
|
|
87
|
+
d(this, ot, !1);
|
|
88
|
+
d(this, Be, "frac");
|
|
89
89
|
// ------------------------------------------
|
|
90
90
|
/**
|
|
91
91
|
* Parse the value to get the numerator and denominator
|
|
@@ -331,10 +331,10 @@ let c = $;
|
|
|
331
331
|
var Z, J, se, We;
|
|
332
332
|
class ft {
|
|
333
333
|
constructor(...e) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
334
|
+
d(this, Z);
|
|
335
|
+
d(this, J);
|
|
336
|
+
d(this, se);
|
|
337
|
+
d(this, We);
|
|
338
338
|
// ------------------------------------------
|
|
339
339
|
// Creation / parsing functions
|
|
340
340
|
// ------------------------------------------
|
|
@@ -394,104 +394,104 @@ class ft {
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
Z = new WeakMap(), J = new WeakMap(), se = new WeakMap(), We = new WeakMap();
|
|
397
|
-
var
|
|
397
|
+
var oi = (o) => {
|
|
398
398
|
throw TypeError(o);
|
|
399
|
-
},
|
|
400
|
-
const
|
|
399
|
+
}, hi = (o, e, t) => e.has(o) || oi("Cannot " + t), K = (o, e, t) => (hi(o, e, "read from private field"), t ? t.call(o) : e.get(o)), tt = (o, e, t) => e.has(o) ? oi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), be = (o, e, t, s) => (hi(o, e, "write to private field"), e.set(o, t), t);
|
|
400
|
+
const ai = {
|
|
401
401
|
pi: Math.PI,
|
|
402
402
|
e: Math.exp(1)
|
|
403
403
|
};
|
|
404
|
-
var
|
|
405
|
-
function
|
|
404
|
+
var m = /* @__PURE__ */ ((o) => (o.VARIABLE = "variable", o.COEFFICIENT = "coefficient", o.OPERATION = "operation", o.CONSTANT = "constant", o.FUNCTION = "function", o.FUNCTION_ARGUMENT = "function-argument", o.MONOM = "monom", o.LEFT_PARENTHESIS = "(", o.RIGHT_PARENTHESIS = ")", o))(m || {}), it = /* @__PURE__ */ ((o) => (o.EXPRESSION = "expression", o.POLYNOM = "polynom", o.SET = "set", o.NUMERIC = "numeric", o))(it || {});
|
|
405
|
+
function Ri(o, e) {
|
|
406
406
|
if (o.length <= 1)
|
|
407
407
|
return o;
|
|
408
|
-
const t = Object.keys(e).filter((E) => e[E].type ===
|
|
408
|
+
const t = Object.keys(e).filter((E) => e[E].type === m.FUNCTION).map((E) => E);
|
|
409
409
|
t.sort((E, L) => L.length - E.length);
|
|
410
|
-
const s = new RegExp(`^(${t.join("|")})\\(`), r = Object.keys(
|
|
410
|
+
const s = new RegExp(`^(${t.join("|")})\\(`), r = Object.keys(ai);
|
|
411
411
|
r.sort((E, L) => L.length - E.length);
|
|
412
412
|
const n = new RegExp(`^(${r.join("|")})`), l = /^(\d+(\.\d+)?)/;
|
|
413
|
-
let u = "",
|
|
413
|
+
let u = "", f, p, g;
|
|
414
414
|
for (; o.length > 0; ) {
|
|
415
|
-
if (
|
|
415
|
+
if (f = p, g = void 0, t.length > 0 && s.exec(o)) {
|
|
416
416
|
const E = t.find((L) => o.startsWith(L));
|
|
417
|
-
E && (g = E + "(", o = o.slice(E.length + 1),
|
|
417
|
+
E && (g = E + "(", o = o.slice(E.length + 1), p = m.FUNCTION);
|
|
418
418
|
} else if (r.length > 0 && n.exec(o)) {
|
|
419
419
|
const E = r.find((L) => o.startsWith(L));
|
|
420
|
-
E && (g = E, o = o.slice(E.length),
|
|
420
|
+
E && (g = E, o = o.slice(E.length), p = m.CONSTANT);
|
|
421
421
|
} else if (l.exec(o)) {
|
|
422
422
|
const E = l.exec(o);
|
|
423
|
-
E && (g = E[0], o = o.slice(E[0].length),
|
|
423
|
+
E && (g = E[0], o = o.slice(E[0].length), p = m.COEFFICIENT);
|
|
424
424
|
} else
|
|
425
425
|
switch (g = o[0], o = o.slice(1), g) {
|
|
426
426
|
case "(":
|
|
427
|
-
|
|
427
|
+
p = m.LEFT_PARENTHESIS;
|
|
428
428
|
break;
|
|
429
429
|
case ")":
|
|
430
|
-
|
|
430
|
+
p = m.RIGHT_PARENTHESIS;
|
|
431
431
|
break;
|
|
432
432
|
case ",":
|
|
433
|
-
|
|
433
|
+
p = m.FUNCTION_ARGUMENT;
|
|
434
434
|
break;
|
|
435
435
|
case "+":
|
|
436
436
|
case "-":
|
|
437
437
|
case "*":
|
|
438
438
|
case "/":
|
|
439
439
|
case "^":
|
|
440
|
-
|
|
440
|
+
p = m.OPERATION;
|
|
441
441
|
break;
|
|
442
442
|
default:
|
|
443
|
-
|
|
443
|
+
p = m.VARIABLE;
|
|
444
444
|
}
|
|
445
|
-
if (g === void 0 ||
|
|
445
|
+
if (g === void 0 || p === void 0)
|
|
446
446
|
throw new Error("The token is undefined");
|
|
447
|
-
u +=
|
|
447
|
+
u += zi(f, p), u += g;
|
|
448
448
|
}
|
|
449
449
|
return u;
|
|
450
450
|
}
|
|
451
|
-
function
|
|
452
|
-
return o === void 0 || o ===
|
|
451
|
+
function zi(o, e) {
|
|
452
|
+
return o === void 0 || o === m.OPERATION || e === m.OPERATION || o === m.LEFT_PARENTHESIS || o === m.FUNCTION || o === m.FUNCTION_ARGUMENT || e === m.RIGHT_PARENTHESIS || e === m.FUNCTION_ARGUMENT ? "" : "*";
|
|
453
453
|
}
|
|
454
|
-
const
|
|
455
|
-
"^": { precedence: 4, associative: "right", type:
|
|
456
|
-
"*": { precedence: 3, associative: "left", type:
|
|
457
|
-
"/": { precedence: 3, associative: "left", type:
|
|
458
|
-
"+": { precedence: 2, associative: "left", type:
|
|
459
|
-
"-": { precedence: 2, associative: "left", type:
|
|
454
|
+
const ki = {
|
|
455
|
+
"^": { precedence: 4, associative: "right", type: m.OPERATION },
|
|
456
|
+
"*": { precedence: 3, associative: "left", type: m.OPERATION },
|
|
457
|
+
"/": { precedence: 3, associative: "left", type: m.OPERATION },
|
|
458
|
+
"+": { precedence: 2, associative: "left", type: m.OPERATION },
|
|
459
|
+
"-": { precedence: 2, associative: "left", type: m.OPERATION }
|
|
460
|
+
}, Li = {
|
|
461
|
+
"^": { precedence: 4, associative: "right", type: m.OPERATION },
|
|
462
|
+
"*": { precedence: 3, associative: "left", type: m.OPERATION },
|
|
463
|
+
"/": { precedence: 3, associative: "left", type: m.OPERATION },
|
|
464
|
+
"+": { precedence: 2, associative: "left", type: m.OPERATION },
|
|
465
|
+
"-": { precedence: 2, associative: "left", type: m.OPERATION },
|
|
466
|
+
"%": { precedence: 3, associative: "right", type: m.OPERATION },
|
|
467
|
+
sin: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
468
|
+
cos: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
469
|
+
tan: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
470
|
+
sqrt: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
471
|
+
nthrt: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
472
|
+
",": { precedence: 2, associative: "left", type: m.FUNCTION_ARGUMENT }
|
|
460
473
|
}, Di = {
|
|
461
|
-
"^": { precedence: 4, associative: "right", type:
|
|
462
|
-
"*": { precedence: 3, associative: "left", type:
|
|
463
|
-
"/": { precedence: 3, associative: "left", type:
|
|
464
|
-
"+": { precedence: 2, associative: "left", type:
|
|
465
|
-
"-": { precedence: 2, associative: "left", type:
|
|
466
|
-
"%": { precedence: 3, associative: "right", type:
|
|
467
|
-
sin: { precedence: 4, associative: "right", type:
|
|
468
|
-
cos: { precedence: 4, associative: "right", type:
|
|
469
|
-
tan: { precedence: 4, associative: "right", type:
|
|
470
|
-
sqrt: { precedence: 4, associative: "right", type:
|
|
471
|
-
nthrt: { precedence: 4, associative: "right", type:
|
|
472
|
-
|
|
474
|
+
"^": { precedence: 4, associative: "right", type: m.OPERATION },
|
|
475
|
+
"*": { precedence: 3, associative: "left", type: m.OPERATION },
|
|
476
|
+
"/": { precedence: 3, associative: "left", type: m.OPERATION },
|
|
477
|
+
"+": { precedence: 2, associative: "left", type: m.OPERATION },
|
|
478
|
+
"-": { precedence: 2, associative: "left", type: m.OPERATION },
|
|
479
|
+
"%": { precedence: 3, associative: "right", type: m.OPERATION },
|
|
480
|
+
sin: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
481
|
+
cos: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
482
|
+
tan: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
483
|
+
sqrt: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
484
|
+
nthrt: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
485
|
+
ln: { precedence: 4, associative: "right", type: m.FUNCTION },
|
|
486
|
+
log: { precedence: 4, associative: "right", type: m.FUNCTION }
|
|
473
487
|
}, Zi = {
|
|
474
|
-
"
|
|
475
|
-
"
|
|
476
|
-
"
|
|
477
|
-
"
|
|
478
|
-
"-": { precedence: 2, associative: "left", type: d.OPERATION },
|
|
479
|
-
"%": { precedence: 3, associative: "right", type: d.OPERATION },
|
|
480
|
-
sin: { precedence: 4, associative: "right", type: d.FUNCTION },
|
|
481
|
-
cos: { precedence: 4, associative: "right", type: d.FUNCTION },
|
|
482
|
-
tan: { precedence: 4, associative: "right", type: d.FUNCTION },
|
|
483
|
-
sqrt: { precedence: 4, associative: "right", type: d.FUNCTION },
|
|
484
|
-
nthrt: { precedence: 4, associative: "right", type: d.FUNCTION },
|
|
485
|
-
ln: { precedence: 4, associative: "right", type: d.FUNCTION },
|
|
486
|
-
log: { precedence: 4, associative: "right", type: d.FUNCTION }
|
|
487
|
-
}, Vi = {
|
|
488
|
-
"&": { precedence: 3, associative: "left", type: d.OPERATION },
|
|
489
|
-
"|": { precedence: 3, associative: "left", type: d.OPERATION },
|
|
490
|
-
"!": { precedence: 4, associative: "right", type: d.OPERATION },
|
|
491
|
-
"-": { precedence: 2, associative: "left", type: d.OPERATION }
|
|
488
|
+
"&": { precedence: 3, associative: "left", type: m.OPERATION },
|
|
489
|
+
"|": { precedence: 3, associative: "left", type: m.OPERATION },
|
|
490
|
+
"!": { precedence: 4, associative: "right", type: m.OPERATION },
|
|
491
|
+
"-": { precedence: 2, associative: "left", type: m.OPERATION }
|
|
492
492
|
};
|
|
493
493
|
var je, st, ie, dt, ke;
|
|
494
|
-
class
|
|
494
|
+
class li {
|
|
495
495
|
constructor(e) {
|
|
496
496
|
tt(this, je), tt(this, st, []), tt(this, ie, {}), tt(this, dt, []), tt(this, ke), be(this, je, typeof e > "u" ? it.POLYNOM : e), this.tokenConfigInitialization();
|
|
497
497
|
}
|
|
@@ -503,7 +503,7 @@ class ci {
|
|
|
503
503
|
return K(this, st).map((e) => e.token);
|
|
504
504
|
}
|
|
505
505
|
tokenConfigInitialization() {
|
|
506
|
-
return K(this, je) === it.SET ? (be(this, ie,
|
|
506
|
+
return K(this, je) === it.SET ? (be(this, ie, Zi), be(this, ke, !1)) : K(this, je) === it.NUMERIC ? (be(this, ie, Di), be(this, ke, !0)) : K(this, je) === it.EXPRESSION ? (be(this, ie, Li), be(this, ke, !0)) : (be(this, ie, ki), be(this, ke, !0)), be(this, dt, Object.keys(K(this, ie)).sort((e, t) => t.length - e.length)), K(this, ie);
|
|
507
507
|
}
|
|
508
508
|
/**
|
|
509
509
|
* Get the next token to analyse.
|
|
@@ -513,31 +513,31 @@ class ci {
|
|
|
513
513
|
NextToken(e, t) {
|
|
514
514
|
let s, r;
|
|
515
515
|
if (s = "", r = void 0, e[t] === "(")
|
|
516
|
-
s = "(", r =
|
|
516
|
+
s = "(", r = m.LEFT_PARENTHESIS;
|
|
517
517
|
else if (e[t] === ")")
|
|
518
|
-
s = ")", r =
|
|
518
|
+
s = ")", r = m.RIGHT_PARENTHESIS;
|
|
519
519
|
else if (e[t] === ",")
|
|
520
|
-
s = ",", r =
|
|
520
|
+
s = ",", r = m.FUNCTION_ARGUMENT;
|
|
521
521
|
else {
|
|
522
522
|
for (const n of K(this, dt))
|
|
523
523
|
if (e.substring(t, t + n.length) === n) {
|
|
524
524
|
s += n, r = K(this, ie)[n].type;
|
|
525
525
|
break;
|
|
526
526
|
}
|
|
527
|
-
for (const n in
|
|
527
|
+
for (const n in ai)
|
|
528
528
|
if (e.substring(t, t + n.length) === n) {
|
|
529
|
-
s += n, r =
|
|
529
|
+
s += n, r = m.CONSTANT;
|
|
530
530
|
break;
|
|
531
531
|
}
|
|
532
532
|
if (s === "")
|
|
533
533
|
if (/[0-9.]/.exec(e[t])) {
|
|
534
534
|
const n = /^([0-9.]+)/.exec(e.substring(t));
|
|
535
|
-
s = n ? n[0] : "", r =
|
|
535
|
+
s = n ? n[0] : "", r = m.COEFFICIENT;
|
|
536
536
|
} else if (/[a-zA-Z]/.exec(e[t])) {
|
|
537
537
|
const n = /^([a-zA-Z])/.exec(e.substring(t));
|
|
538
|
-
s = n ? n[0] : "", r =
|
|
538
|
+
s = n ? n[0] : "", r = m.VARIABLE;
|
|
539
539
|
} else
|
|
540
|
-
console.log("Unidentified token", e[t], e, t), s = e[t], r =
|
|
540
|
+
console.log("Unidentified token", e[t], e, t), s = e[t], r = m.MONOM;
|
|
541
541
|
}
|
|
542
542
|
if (r === void 0)
|
|
543
543
|
throw new Error(`Token type is undefined for token ${s}`);
|
|
@@ -552,43 +552,43 @@ class ci {
|
|
|
552
552
|
parse(e, t) {
|
|
553
553
|
const s = [], r = [];
|
|
554
554
|
let n = "", l = 0, u;
|
|
555
|
-
(t ?? K(this, ke)) && (e =
|
|
556
|
-
const
|
|
557
|
-
let
|
|
555
|
+
(t ?? K(this, ke)) && (e = Ri(e, K(this, ie)));
|
|
556
|
+
const f = 50;
|
|
557
|
+
let p = 50, g;
|
|
558
558
|
for (; l < e.length; ) {
|
|
559
|
-
if (
|
|
559
|
+
if (p--, p === 0) {
|
|
560
560
|
console.log("SECURITY LEVEL 1 EXIT");
|
|
561
561
|
break;
|
|
562
562
|
}
|
|
563
563
|
switch ([n, l, u] = this.NextToken(e, l), u) {
|
|
564
|
-
case
|
|
565
|
-
case
|
|
566
|
-
case
|
|
567
|
-
case
|
|
564
|
+
case m.MONOM:
|
|
565
|
+
case m.COEFFICIENT:
|
|
566
|
+
case m.VARIABLE:
|
|
567
|
+
case m.CONSTANT:
|
|
568
568
|
s.push({
|
|
569
569
|
token: n,
|
|
570
570
|
tokenType: u
|
|
571
571
|
});
|
|
572
572
|
break;
|
|
573
|
-
case
|
|
573
|
+
case m.OPERATION:
|
|
574
574
|
if (r.length > 0) {
|
|
575
575
|
let E = r[r.length - 1];
|
|
576
|
-
for (g = +
|
|
576
|
+
for (g = +f; E.token in K(this, ie) && //either o1 is left-associative and its precedence is less than or equal to that of o2,
|
|
577
577
|
(K(this, ie)[n].associative === "left" && K(this, ie)[n].precedence <= K(this, ie)[E.token].precedence || //or o1 is right associative, and has precedence less than that of o2,
|
|
578
578
|
K(this, ie)[n].associative === "right" && K(this, ie)[n].precedence < K(this, ie)[E.token].precedence); ) {
|
|
579
579
|
if (g--, g === 0) {
|
|
580
580
|
console.log("SECURITY LEVEL 2 OPERATION EXIT");
|
|
581
581
|
break;
|
|
582
582
|
}
|
|
583
|
-
if (s.push(r.pop() ?? { token: "", tokenType:
|
|
583
|
+
if (s.push(r.pop() ?? { token: "", tokenType: m.OPERATION }), r.length === 0)
|
|
584
584
|
break;
|
|
585
585
|
E = r[r.length - 1];
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
r.push({ token: n, tokenType: u });
|
|
589
589
|
break;
|
|
590
|
-
case
|
|
591
|
-
for (g = +
|
|
590
|
+
case m.FUNCTION_ARGUMENT:
|
|
591
|
+
for (g = +f; r[r.length - 1].token !== "(" && r.length > 0; ) {
|
|
592
592
|
if (g--, g === 0) {
|
|
593
593
|
console.log("SECURITY LEVEL 2 FUNCTION ARGUMENT EXIT");
|
|
594
594
|
break;
|
|
@@ -596,11 +596,11 @@ class ci {
|
|
|
596
596
|
s.push(r.pop() ?? { token: n, tokenType: u });
|
|
597
597
|
}
|
|
598
598
|
break;
|
|
599
|
-
case
|
|
600
|
-
r.push({ token: n, tokenType: u }), e[l] === "-" && s.push({ token: "0", tokenType:
|
|
599
|
+
case m.LEFT_PARENTHESIS:
|
|
600
|
+
r.push({ token: n, tokenType: u }), e[l] === "-" && s.push({ token: "0", tokenType: m.COEFFICIENT });
|
|
601
601
|
break;
|
|
602
|
-
case
|
|
603
|
-
for (g = +
|
|
602
|
+
case m.RIGHT_PARENTHESIS:
|
|
603
|
+
for (g = +f; r[r.length - 1].token !== "(" && r.length > 1; ) {
|
|
604
604
|
if (g--, g === 0) {
|
|
605
605
|
console.log("SECURITY LEVEL 2 CLOSING PARENTHESIS EXIT");
|
|
606
606
|
break;
|
|
@@ -609,7 +609,7 @@ class ci {
|
|
|
609
609
|
}
|
|
610
610
|
r.pop();
|
|
611
611
|
break;
|
|
612
|
-
case
|
|
612
|
+
case m.FUNCTION:
|
|
613
613
|
r.push({ token: n, tokenType: u });
|
|
614
614
|
break;
|
|
615
615
|
default:
|
|
@@ -623,9 +623,9 @@ je = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), ie = /*
|
|
|
623
623
|
var O, v, He, pt, Re, bt, xt;
|
|
624
624
|
const P = class P {
|
|
625
625
|
constructor(e) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
626
|
+
d(this, He);
|
|
627
|
+
d(this, O);
|
|
628
|
+
d(this, v);
|
|
629
629
|
/**
|
|
630
630
|
* Clone the current Monom.
|
|
631
631
|
*/
|
|
@@ -855,7 +855,7 @@ const P = class P {
|
|
|
855
855
|
* Create a zero value monom
|
|
856
856
|
*/
|
|
857
857
|
a(this, "zero", () => (h(this, O, new c().zero()), h(this, v, {}), this));
|
|
858
|
-
|
|
858
|
+
d(this, Re, (e) => {
|
|
859
859
|
let t = this.coefficient.value;
|
|
860
860
|
if (typeof e == "number") {
|
|
861
861
|
const s = {}, r = this.variables[0];
|
|
@@ -877,27 +877,27 @@ const P = class P {
|
|
|
877
877
|
}
|
|
878
878
|
return t;
|
|
879
879
|
});
|
|
880
|
-
|
|
881
|
-
const s = new
|
|
880
|
+
d(this, bt, (e) => {
|
|
881
|
+
const s = new li().parse(e).rpn, r = [];
|
|
882
882
|
if (s.length === 0)
|
|
883
883
|
return this.zero(), this;
|
|
884
884
|
if (s.length === 1) {
|
|
885
885
|
const n = s[0];
|
|
886
|
-
return this.one(), n.tokenType ===
|
|
886
|
+
return this.one(), n.tokenType === m.COEFFICIENT ? this.coefficient = new c(n.token) : n.tokenType === m.VARIABLE && this.setLetter(n.token, 1), this;
|
|
887
887
|
} else
|
|
888
888
|
for (const n of s)
|
|
889
889
|
i(this, xt).call(this, r, n);
|
|
890
890
|
return this.one(), this.multiply(r[0]), this;
|
|
891
891
|
});
|
|
892
|
-
|
|
893
|
-
var
|
|
892
|
+
d(this, xt, (e, t) => {
|
|
893
|
+
var f;
|
|
894
894
|
let s, r, n, l, u;
|
|
895
|
-
if (t.tokenType ===
|
|
895
|
+
if (t.tokenType === m.COEFFICIENT)
|
|
896
896
|
e.push(new P(new c(t.token)));
|
|
897
|
-
else if (t.tokenType ===
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
} else if (t.tokenType ===
|
|
897
|
+
else if (t.tokenType === m.VARIABLE) {
|
|
898
|
+
const p = new P().one();
|
|
899
|
+
p.setLetter(t.token, 1), e.push(p.clone());
|
|
900
|
+
} else if (t.tokenType === m.OPERATION)
|
|
901
901
|
switch (t.token) {
|
|
902
902
|
case "-":
|
|
903
903
|
r = e.pop() ?? new P().zero(), s = e.pop() ?? new P().zero(), e.push(s.subtract(r));
|
|
@@ -909,7 +909,7 @@ const P = class P {
|
|
|
909
909
|
r = e.pop() ?? new P().one(), s = e.pop() ?? new P().one(), e.push(s.divide(r));
|
|
910
910
|
break;
|
|
911
911
|
case "^": {
|
|
912
|
-
u = ((
|
|
912
|
+
u = ((f = e.pop()) == null ? void 0 : f.coefficient) ?? new c().one(), n = e.pop() ?? new P().one(), l = n.variables[0], l && n.setLetter(l, u), e.push(n);
|
|
913
913
|
break;
|
|
914
914
|
}
|
|
915
915
|
}
|
|
@@ -1097,12 +1097,12 @@ a(P, "xMultiply", (...e) => {
|
|
|
1097
1097
|
return t;
|
|
1098
1098
|
});
|
|
1099
1099
|
let I = P;
|
|
1100
|
-
var ue, De, S, ye, rt, ui, fi,
|
|
1101
|
-
const
|
|
1100
|
+
var ue, De, S, ye, rt, ci, ui, fi, Wt, di;
|
|
1101
|
+
const ti = class ti {
|
|
1102
1102
|
constructor(e, t, s = "x") {
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1103
|
+
d(this, S);
|
|
1104
|
+
d(this, ue);
|
|
1105
|
+
d(this, De);
|
|
1106
1106
|
if (h(this, De, s), Object.hasOwn(e, "moveLeft")) {
|
|
1107
1107
|
const r = e;
|
|
1108
1108
|
h(this, ue, r.left.clone().subtract(r.right));
|
|
@@ -1111,20 +1111,20 @@ const ii = class ii {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
solve() {
|
|
1113
1113
|
if (i(this, ue).degree().isOne())
|
|
1114
|
-
return M(this, S,
|
|
1114
|
+
return M(this, S, ci).call(this);
|
|
1115
1115
|
if (i(this, ue).degree().value === 2)
|
|
1116
|
-
return M(this, S,
|
|
1117
|
-
const e = M(this, S,
|
|
1116
|
+
return M(this, S, ui).call(this);
|
|
1117
|
+
const e = M(this, S, di).call(this);
|
|
1118
1118
|
if (e.length > 0)
|
|
1119
1119
|
return e;
|
|
1120
1120
|
if (i(this, ue).degree().value === 3)
|
|
1121
|
-
return M(this, S,
|
|
1121
|
+
return M(this, S, Wt).call(this);
|
|
1122
1122
|
throw new Error("The equation degree is too high.");
|
|
1123
1123
|
}
|
|
1124
1124
|
solveAsCardan() {
|
|
1125
1125
|
if (i(this, ue).degree().value !== 3)
|
|
1126
1126
|
throw new Error("The equation is not cubic.");
|
|
1127
|
-
return M(this, S,
|
|
1127
|
+
return M(this, S, Wt).call(this);
|
|
1128
1128
|
}
|
|
1129
1129
|
};
|
|
1130
1130
|
ue = new WeakMap(), De = new WeakMap(), S = new WeakSet(), ye = function(e) {
|
|
@@ -1146,44 +1146,44 @@ ue = new WeakMap(), De = new WeakMap(), S = new WeakSet(), ye = function(e) {
|
|
|
1146
1146
|
tex: (t == null ? void 0 : t.tex) ?? "",
|
|
1147
1147
|
display: (t == null ? void 0 : t.display) ?? ""
|
|
1148
1148
|
};
|
|
1149
|
-
},
|
|
1149
|
+
}, ci = function() {
|
|
1150
1150
|
const e = i(this, ue).monomByDegree(0).coefficient.clone().opposite().divide(i(this, ue).monomByDegree(1).coefficient);
|
|
1151
1151
|
return [
|
|
1152
1152
|
M(this, S, ye).call(this, e)
|
|
1153
1153
|
];
|
|
1154
|
-
},
|
|
1154
|
+
}, ui = function() {
|
|
1155
1155
|
const e = i(this, ue), t = e.monomByDegree(2).coefficient, s = e.monomByDegree(1).coefficient, r = e.monomByDegree(0).coefficient, n = s.clone().pow(2).subtract(t.clone().multiply(r).multiply(4));
|
|
1156
1156
|
if (n.isNegative())
|
|
1157
1157
|
return [];
|
|
1158
1158
|
if (n.isSquare()) {
|
|
1159
|
-
const l = n.sqrt(), u = s.clone().opposite().add(l).divide(t.clone().multiply(2)),
|
|
1159
|
+
const l = n.sqrt(), u = s.clone().opposite().add(l).divide(t.clone().multiply(2)), f = s.clone().opposite().subtract(l).divide(t.clone().multiply(2));
|
|
1160
1160
|
return l.isZero() ? [M(this, S, ye).call(this, u)] : [
|
|
1161
1161
|
M(this, S, ye).call(this, u),
|
|
1162
|
-
M(this, S, ye).call(this,
|
|
1163
|
-
].sort((
|
|
1162
|
+
M(this, S, ye).call(this, f)
|
|
1163
|
+
].sort((p, g) => p.value - g.value);
|
|
1164
1164
|
}
|
|
1165
|
-
return M(this, S,
|
|
1166
|
-
},
|
|
1167
|
-
const r = G.dividers(s.value).filter((pe) => Math.sqrt(pe) % 1 === 0).map((pe) => Math.sqrt(pe)).pop() ?? 1, n = G.gcd(2 * e.value, t.value, r) * (e.isNegative() ? -1 : 1), l = t.clone().divide(n).opposite(), u = e.clone().divide(n).multiply(2),
|
|
1168
|
-
function L(pe, ce, et,
|
|
1169
|
-
return `\\frac{ ${ce} ${et}\\sqrt{ ${
|
|
1165
|
+
return M(this, S, fi).call(this, t, s, n);
|
|
1166
|
+
}, fi = function(e, t, s) {
|
|
1167
|
+
const r = G.dividers(s.value).filter((pe) => Math.sqrt(pe) % 1 === 0).map((pe) => Math.sqrt(pe)).pop() ?? 1, n = G.gcd(2 * e.value, t.value, r) * (e.isNegative() ? -1 : 1), l = t.clone().divide(n).opposite(), u = e.clone().divide(n).multiply(2), f = s.clone().divide(r ** 2), p = Math.abs(r / n), g = r === 1 ? "-" : `-${p} `, E = r === 1 ? "+" : `+${p} `;
|
|
1168
|
+
function L(pe, ce, et, jt) {
|
|
1169
|
+
return `\\frac{ ${ce} ${et}\\sqrt{ ${jt} } }{ ${pe} }`;
|
|
1170
1170
|
}
|
|
1171
|
-
function te(pe, ce, et,
|
|
1172
|
-
return `(${ce}${et}sqrt(${
|
|
1171
|
+
function te(pe, ce, et, jt) {
|
|
1172
|
+
return `(${ce}${et}sqrt(${jt}))/${pe}`;
|
|
1173
1173
|
}
|
|
1174
1174
|
const ae = s.value ** 0.5, le = (-t.value - ae) / (2 * e.value), ge = (-t.value + ae) / (2 * e.value);
|
|
1175
1175
|
return [
|
|
1176
1176
|
M(this, S, rt).call(this, le, {
|
|
1177
|
-
tex: L(u.tex, l.tex, g.toString(),
|
|
1178
|
-
display: te(u.display, l.display, g.toString(),
|
|
1177
|
+
tex: L(u.tex, l.tex, g.toString(), f.tex),
|
|
1178
|
+
display: te(u.display, l.display, g.toString(), f.display)
|
|
1179
1179
|
}),
|
|
1180
1180
|
M(this, S, rt).call(this, ge, {
|
|
1181
|
-
tex: L(u.tex, l.tex, E.toString(),
|
|
1182
|
-
display: te(u.display, l.display, E.toString(),
|
|
1181
|
+
tex: L(u.tex, l.tex, E.toString(), f.tex),
|
|
1182
|
+
display: te(u.display, l.display, E.toString(), f.display)
|
|
1183
1183
|
})
|
|
1184
1184
|
].sort((pe, ce) => pe.value - ce.value);
|
|
1185
|
-
},
|
|
1186
|
-
const e = i(this, ue), t = e.monomByDegree(3).coefficient, s = e.monomByDegree(2).coefficient, r = e.monomByDegree(1).coefficient, n = e.monomByDegree(0).coefficient, l = s.clone().divide(t), u = r.clone().divide(t),
|
|
1185
|
+
}, Wt = function() {
|
|
1186
|
+
const e = i(this, ue), t = e.monomByDegree(3).coefficient, s = e.monomByDegree(2).coefficient, r = e.monomByDegree(1).coefficient, n = e.monomByDegree(0).coefficient, l = s.clone().divide(t), u = r.clone().divide(t), f = n.clone().divide(t), p = u.clone().subtract(l.clone().pow(2).divide(3)), g = f.clone().subtract(l.clone().multiply(u).divide(3)).add(l.clone().pow(3).multiply(2).divide(27)), E = g.clone().opposite(), L = p.clone().opposite().pow(3).divide(27), te = E.clone().pow(2).subtract(L.clone().multiply(4)).opposite();
|
|
1187
1187
|
if (te.isNegative()) {
|
|
1188
1188
|
const ae = g.clone().opposite().add(te.clone().opposite().sqrt()).divide(2).root(3), le = g.clone().opposite().subtract(te.clone().opposite().sqrt()).divide(2).root(3), ge = ae.clone().add(le).subtract(l.clone().divide(3));
|
|
1189
1189
|
return [M(this, S, ye).call(this, ge)];
|
|
@@ -1196,13 +1196,13 @@ ue = new WeakMap(), De = new WeakMap(), S = new WeakSet(), ye = function(e) {
|
|
|
1196
1196
|
].sort((pe, ce) => pe.value - ce.value);
|
|
1197
1197
|
}
|
|
1198
1198
|
if (te.isPositive()) {
|
|
1199
|
-
const ae = [], le =
|
|
1199
|
+
const ae = [], le = p.value, ge = g.value, pe = l.value;
|
|
1200
1200
|
for (let ce = 0; ce < 3; ce++)
|
|
1201
1201
|
ae.push(2 * Math.sqrt(-le / 3) * Math.cos(Math.acos(3 * ge / (2 * le) * Math.sqrt(-3 / le)) / 3 + 2 * Math.PI * ce / 3) - pe / 3);
|
|
1202
1202
|
return ae.map((ce) => M(this, S, rt).call(this, ce)).sort((ce, et) => ce.value - et.value);
|
|
1203
1203
|
}
|
|
1204
1204
|
return [];
|
|
1205
|
-
},
|
|
1205
|
+
}, di = function() {
|
|
1206
1206
|
let e = i(this, ue).clone(), t = [];
|
|
1207
1207
|
const s = e.lcmDenominator();
|
|
1208
1208
|
s !== 1 && e.multiply(s);
|
|
@@ -1227,19 +1227,19 @@ ue = new WeakMap(), De = new WeakMap(), S = new WeakSet(), ye = function(e) {
|
|
|
1227
1227
|
return t.sort((g, E) => g.value - E.value);
|
|
1228
1228
|
if (e.degree().value > 3)
|
|
1229
1229
|
return [];
|
|
1230
|
-
const
|
|
1231
|
-
console.log(e.display), console.log(
|
|
1232
|
-
const
|
|
1233
|
-
return t = t.concat(
|
|
1230
|
+
const f = e.clone().parse("0");
|
|
1231
|
+
console.log(e.display), console.log(f.display);
|
|
1232
|
+
const p = new ti(e, e.clone().parse("0"), i(this, De));
|
|
1233
|
+
return t = t.concat(p.solve()), t.sort((g, E) => g.value - E.value);
|
|
1234
1234
|
};
|
|
1235
|
-
let gt =
|
|
1236
|
-
var Ze, y, Xe, ht, Et, Nt, Ot, qt, at, Tt, At, Mt, It,
|
|
1235
|
+
let gt = ti;
|
|
1236
|
+
var Ze, y, Xe, ht, Et, Nt, Ot, qt, at, Tt, At, Mt, It, pi, Ct, Ye, $t;
|
|
1237
1237
|
const C = class C {
|
|
1238
1238
|
constructor(e, ...t) {
|
|
1239
|
-
|
|
1239
|
+
d(this, It);
|
|
1240
1240
|
// #region Class fields (8)
|
|
1241
|
-
|
|
1242
|
-
|
|
1241
|
+
d(this, Ze);
|
|
1242
|
+
d(this, y);
|
|
1243
1243
|
// #endregion Constructors (7)
|
|
1244
1244
|
// #region Properties and methods (49)
|
|
1245
1245
|
/**
|
|
@@ -1249,7 +1249,7 @@ const C = class C {
|
|
|
1249
1249
|
*/
|
|
1250
1250
|
a(this, "parse", (e, ...t) => {
|
|
1251
1251
|
if (h(this, y, []), h(this, Ze, []), typeof e == "string")
|
|
1252
|
-
return M(this, It,
|
|
1252
|
+
return M(this, It, pi).call(this, e, ...t);
|
|
1253
1253
|
if ((typeof e == "number" || e instanceof c || e instanceof I) && t.length === 0)
|
|
1254
1254
|
i(this, y).push(new I(e));
|
|
1255
1255
|
else if (e instanceof I && t.length > 0)
|
|
@@ -1331,8 +1331,8 @@ const C = class C {
|
|
|
1331
1331
|
reminder: new C().zero()
|
|
1332
1332
|
};
|
|
1333
1333
|
const n = e.monomByDegree(void 0, t), l = e.degree(t);
|
|
1334
|
-
let u,
|
|
1335
|
-
for (; r.degree(t).isGeq(l) &&
|
|
1334
|
+
let u, f = this.degree(t).value * 2;
|
|
1335
|
+
for (; r.degree(t).isGeq(l) && f > 0 && (f--, u = r.monomByDegree(void 0, t).clone().divide(n), !(!u.isZero() && (s.add(u), r.subtract(e.clone().multiply(u)).reduce(), u.degree(t).isZero()))); )
|
|
1336
1336
|
;
|
|
1337
1337
|
return s.reduce(), r.reduce(), { quotient: s, reminder: r };
|
|
1338
1338
|
});
|
|
@@ -1367,12 +1367,12 @@ const C = class C {
|
|
|
1367
1367
|
} else {
|
|
1368
1368
|
let u = i(this, qt).call(this, s, l, e ?? "x");
|
|
1369
1369
|
for (l = s.degree(e).value; u.length > 0; ) {
|
|
1370
|
-
const
|
|
1371
|
-
if (!s.isDividableBy(
|
|
1370
|
+
const f = u[0];
|
|
1371
|
+
if (!s.isDividableBy(f))
|
|
1372
1372
|
u.shift();
|
|
1373
1373
|
else {
|
|
1374
|
-
const
|
|
1375
|
-
t.push(
|
|
1374
|
+
const p = s.euclidean(f);
|
|
1375
|
+
t.push(f), s = p.quotient.clone(), u = u.filter((g) => {
|
|
1376
1376
|
const E = s.monoms[0], L = s.monoms[s.monoms.length - 1], te = g.monoms[0], ae = g.monoms[g.monoms.length - 1];
|
|
1377
1377
|
return L.isDivisible(ae) ? E.isDivisible(te) : !1;
|
|
1378
1378
|
});
|
|
@@ -1519,10 +1519,10 @@ const C = class C {
|
|
|
1519
1519
|
if (l !== u)
|
|
1520
1520
|
return t ? l - u : u - l;
|
|
1521
1521
|
if (s.length > 0)
|
|
1522
|
-
for (const
|
|
1523
|
-
const
|
|
1524
|
-
if (
|
|
1525
|
-
return t ?
|
|
1522
|
+
for (const f of s) {
|
|
1523
|
+
const p = r.degree(f).value, g = n.degree(f).value;
|
|
1524
|
+
if (p !== g)
|
|
1525
|
+
return t ? p - g : g - p;
|
|
1526
1526
|
}
|
|
1527
1527
|
return 0;
|
|
1528
1528
|
}), this;
|
|
@@ -1551,7 +1551,7 @@ const C = class C {
|
|
|
1551
1551
|
a(this, "zero", () => (h(this, y, []), i(this, y).push(new I().zero()), this));
|
|
1552
1552
|
// #endregion Getters And Setters (22)
|
|
1553
1553
|
// #region Private methods (15)
|
|
1554
|
-
|
|
1554
|
+
d(this, Xe, (e, t) => {
|
|
1555
1555
|
t === void 0 && (t = "=");
|
|
1556
1556
|
const s = this.clone().reduce().reorder(), r = e.clone().reduce().reorder();
|
|
1557
1557
|
switch (t) {
|
|
@@ -1563,34 +1563,34 @@ const C = class C {
|
|
|
1563
1563
|
return !1;
|
|
1564
1564
|
}
|
|
1565
1565
|
});
|
|
1566
|
-
|
|
1566
|
+
d(this, ht, (e) => {
|
|
1567
1567
|
for (const t of i(this, y))
|
|
1568
1568
|
t.coefficient.divide(e);
|
|
1569
1569
|
return this;
|
|
1570
1570
|
});
|
|
1571
|
-
|
|
1571
|
+
d(this, Et, (e) => {
|
|
1572
1572
|
const t = new c(e);
|
|
1573
1573
|
for (const s of i(this, y))
|
|
1574
1574
|
s.coefficient.divide(t);
|
|
1575
1575
|
return this;
|
|
1576
1576
|
});
|
|
1577
|
-
|
|
1577
|
+
d(this, Nt, (e) => {
|
|
1578
1578
|
let t = 0;
|
|
1579
1579
|
return i(this, y).forEach((s) => {
|
|
1580
1580
|
t += s.evaluate(e, !0);
|
|
1581
1581
|
}), t;
|
|
1582
1582
|
});
|
|
1583
|
-
|
|
1583
|
+
d(this, Ot, (e) => {
|
|
1584
1584
|
var E;
|
|
1585
|
-
let t, s, r, n, l, u,
|
|
1585
|
+
let t, s, r, n, l, u, f, p, g;
|
|
1586
1586
|
if (this.numberOfVars === 1)
|
|
1587
|
-
return r = this.monomByDegree(2, e).coefficient, n = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, u = n.clone().pow(2).subtract(r.clone().multiply(l).multiply(4)), u.isZero() ? (
|
|
1588
|
-
new C(e).subtract(
|
|
1589
|
-
new C(e).subtract(
|
|
1587
|
+
return r = this.monomByDegree(2, e).coefficient, n = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, u = n.clone().pow(2).subtract(r.clone().multiply(l).multiply(4)), u.isZero() ? (f = n.clone().opposite().divide(r.clone().multiply(2)), t = new C(e).subtract(f.display).multiply(f.denominator), s = new C(e).subtract(f.display).multiply(f.denominator), g = r.divide(f.denominator).divide(f.denominator), g.isOne() ? [t, s] : [new C(g.display), t, s]) : u.isPositive() && u.isSquare() ? (f = n.clone().opposite().add(u.clone().sqrt()).divide(r.clone().multiply(2)), p = n.clone().opposite().subtract(u.clone().sqrt()).divide(r.clone().multiply(2)), g = r.divide(f.denominator).divide(p.denominator), g.isOne() ? [
|
|
1588
|
+
new C(e).subtract(f.display).multiply(f.denominator),
|
|
1589
|
+
new C(e).subtract(p.display).multiply(p.denominator)
|
|
1590
1590
|
] : [
|
|
1591
1591
|
new C(g.display),
|
|
1592
|
-
new C(e).subtract(
|
|
1593
|
-
new C(e).subtract(
|
|
1592
|
+
new C(e).subtract(f.display).multiply(f.denominator),
|
|
1593
|
+
new C(e).subtract(p.display).multiply(p.denominator)
|
|
1594
1594
|
]) : [this.clone()];
|
|
1595
1595
|
if (r = this.monomByDegree(2, e), n = this.monomByDegree(1, e), l = this.monomByDegree(0, e), r.isLiteralSquare() && l.isLiteralSquare() && n.clone().pow(2).isSameAs(r.clone().multiply(l))) {
|
|
1596
1596
|
const L = new C("x", r.coefficient, n.coefficient, l.coefficient), te = i(E = L, Ot).call(E, "x"), ae = [];
|
|
@@ -1603,44 +1603,44 @@ const C = class C {
|
|
|
1603
1603
|
}
|
|
1604
1604
|
return [this.clone()];
|
|
1605
1605
|
});
|
|
1606
|
-
|
|
1606
|
+
d(this, qt, (e, t, s) => {
|
|
1607
1607
|
const r = e.monoms[0].dividers, n = e.monoms[e.monoms.length - 1].dividers, l = [];
|
|
1608
1608
|
return r.forEach((u) => {
|
|
1609
|
-
u.degree(s).isLeq(t) && n.forEach((
|
|
1610
|
-
u.degree(s).isNotEqual(
|
|
1609
|
+
u.degree(s).isLeq(t) && n.forEach((f) => {
|
|
1610
|
+
u.degree(s).isNotEqual(f.degree(s)) && (l.push(new C(u, f)), l.push(new C(u, f.clone().opposite())));
|
|
1611
1611
|
});
|
|
1612
1612
|
}), l;
|
|
1613
1613
|
});
|
|
1614
|
-
|
|
1614
|
+
d(this, at, (e) => {
|
|
1615
1615
|
for (const t of i(this, y))
|
|
1616
1616
|
t.coefficient.multiply(e);
|
|
1617
1617
|
return this.reduce();
|
|
1618
1618
|
});
|
|
1619
|
-
|
|
1620
|
-
|
|
1619
|
+
d(this, Tt, (e) => i(this, at).call(this, new c(e)));
|
|
1620
|
+
d(this, At, (e) => {
|
|
1621
1621
|
for (const t of i(this, y))
|
|
1622
1622
|
t.multiply(e);
|
|
1623
1623
|
return this.reduce();
|
|
1624
1624
|
});
|
|
1625
|
-
|
|
1625
|
+
d(this, Mt, (e) => {
|
|
1626
1626
|
const t = [];
|
|
1627
1627
|
for (const s of i(this, y))
|
|
1628
1628
|
for (const r of e.monoms)
|
|
1629
1629
|
t.push(I.xMultiply(s, r));
|
|
1630
1630
|
return h(this, y, t), this.reduce();
|
|
1631
1631
|
});
|
|
1632
|
-
|
|
1632
|
+
d(this, Ct, (e, t) => {
|
|
1633
1633
|
switch (t.tokenType) {
|
|
1634
|
-
case
|
|
1634
|
+
case m.COEFFICIENT:
|
|
1635
1635
|
e.push(new C(t.token));
|
|
1636
1636
|
break;
|
|
1637
|
-
case
|
|
1637
|
+
case m.VARIABLE:
|
|
1638
1638
|
e.push(new C().add(new I(t.token)));
|
|
1639
1639
|
break;
|
|
1640
|
-
case
|
|
1640
|
+
case m.CONSTANT:
|
|
1641
1641
|
console.log("Actually, not supported - will be added later !");
|
|
1642
1642
|
break;
|
|
1643
|
-
case
|
|
1643
|
+
case m.OPERATION:
|
|
1644
1644
|
if (e.length >= 2) {
|
|
1645
1645
|
const s = e.pop(), r = e.pop();
|
|
1646
1646
|
if (r === void 0 || s === void 0)
|
|
@@ -1670,15 +1670,15 @@ const C = class C {
|
|
|
1670
1670
|
} else
|
|
1671
1671
|
throw new Error("Error parsing the polynom");
|
|
1672
1672
|
break;
|
|
1673
|
-
case
|
|
1673
|
+
case m.MONOM:
|
|
1674
1674
|
console.error("The monom token should not appear here");
|
|
1675
1675
|
break;
|
|
1676
|
-
case
|
|
1676
|
+
case m.FUNCTION:
|
|
1677
1677
|
console.error("The function token should not appear here - might be introduced later.");
|
|
1678
1678
|
break;
|
|
1679
1679
|
}
|
|
1680
1680
|
});
|
|
1681
|
-
|
|
1681
|
+
d(this, Ye, (e, t, s, r) => {
|
|
1682
1682
|
let n = "";
|
|
1683
1683
|
for (const l of i(this, y)) {
|
|
1684
1684
|
if (l.coefficient.value === 0)
|
|
@@ -1692,8 +1692,8 @@ const C = class C {
|
|
|
1692
1692
|
* Main parse using a shutting yard class
|
|
1693
1693
|
* @param inputStr
|
|
1694
1694
|
*/
|
|
1695
|
-
|
|
1696
|
-
const s = new
|
|
1695
|
+
d(this, $t, (e) => {
|
|
1696
|
+
const s = new li().parse(e).rpn;
|
|
1697
1697
|
this.zero();
|
|
1698
1698
|
const r = [];
|
|
1699
1699
|
for (const n of s)
|
|
@@ -1758,7 +1758,7 @@ const C = class C {
|
|
|
1758
1758
|
}
|
|
1759
1759
|
// #endregion Private methods (15)
|
|
1760
1760
|
};
|
|
1761
|
-
Ze = new WeakMap(), y = new WeakMap(), Xe = new WeakMap(), ht = new WeakMap(), Et = new WeakMap(), Nt = new WeakMap(), Ot = new WeakMap(), qt = new WeakMap(), at = new WeakMap(), Tt = new WeakMap(), At = new WeakMap(), Mt = new WeakMap(), It = new WeakSet(),
|
|
1761
|
+
Ze = new WeakMap(), y = new WeakMap(), Xe = new WeakMap(), ht = new WeakMap(), Et = new WeakMap(), Nt = new WeakMap(), Ot = new WeakMap(), qt = new WeakMap(), at = new WeakMap(), Tt = new WeakMap(), At = new WeakMap(), Mt = new WeakMap(), It = new WeakSet(), pi = function(e, ...t) {
|
|
1762
1762
|
if (t.length === 0) {
|
|
1763
1763
|
if (e = "" + e, e !== "" && !isNaN(Number(e))) {
|
|
1764
1764
|
this.empty();
|
|
@@ -1788,16 +1788,16 @@ Ze = new WeakMap(), y = new WeakMap(), Xe = new WeakMap(), ht = new WeakMap(), E
|
|
|
1788
1788
|
return this.zero();
|
|
1789
1789
|
}, Ct = new WeakMap(), Ye = new WeakMap(), $t = new WeakMap();
|
|
1790
1790
|
let T = C;
|
|
1791
|
-
function
|
|
1791
|
+
function ri(o, e = !0) {
|
|
1792
1792
|
return e ? `\\left( ${o} \\right)` : `(${o})`;
|
|
1793
1793
|
}
|
|
1794
1794
|
var Ee, Qe, Ne, Oe;
|
|
1795
1795
|
const we = class we {
|
|
1796
1796
|
constructor(e, t) {
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1797
|
+
d(this, Ee);
|
|
1798
|
+
d(this, Qe, !1);
|
|
1799
|
+
d(this, Ne);
|
|
1800
|
+
d(this, Oe);
|
|
1801
1801
|
if (e instanceof we)
|
|
1802
1802
|
h(this, Ne, e.polynom.clone()), h(this, Oe, e.power.clone());
|
|
1803
1803
|
else if (typeof e == "string" && t === void 0) {
|
|
@@ -1843,7 +1843,7 @@ const we = class we {
|
|
|
1843
1843
|
get display() {
|
|
1844
1844
|
const e = this.power.numerator, t = this.power.denominator;
|
|
1845
1845
|
let s, r;
|
|
1846
|
-
return i(this, Ee) === 0 && t > 1 ? (s = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, r = Math.abs(e) === 1 ? "" : `^(${Math.abs(e)})`) : (s = i(this, Qe) && this.power.isOne() ? this.polynom.display :
|
|
1846
|
+
return i(this, Ee) === 0 && t > 1 ? (s = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, r = Math.abs(e) === 1 ? "" : `^(${Math.abs(e)})`) : (s = i(this, Qe) && this.power.isOne() ? this.polynom.display : ri(this.polynom.display, !1), r = t === 1 && Math.abs(e) === 1 ? "" : `^(${this.power.display})`), s = `${s}${r}`, i(this, Ee) === 0 && e < 0 && (s = `1/(${s})`), s;
|
|
1847
1847
|
}
|
|
1848
1848
|
divide(e) {
|
|
1849
1849
|
if (e instanceof we && this.isSameAs(e))
|
|
@@ -1922,7 +1922,7 @@ const we = class we {
|
|
|
1922
1922
|
get tex() {
|
|
1923
1923
|
const e = this.power.numerator, t = this.power.denominator;
|
|
1924
1924
|
let s, r;
|
|
1925
|
-
return i(this, Ee) === 0 && t > 1 ? (s = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, r = Math.abs(e) === 1 ? "" : `^{ ${Math.abs(e)} }`) : (s = i(this, Qe) && this.power.isOne() ? this.polynom.tex :
|
|
1925
|
+
return i(this, Ee) === 0 && t > 1 ? (s = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, r = Math.abs(e) === 1 ? "" : `^{ ${Math.abs(e)} }`) : (s = i(this, Qe) && this.power.isOne() ? this.polynom.tex : ri(this.polynom.tex), r = t === 1 && Math.abs(e) === 1 ? "" : `^{ ${this.power.tex} }`), s = `${s}${r}`, i(this, Ee) === 0 && e < 0 && (s = `\\frac{ 1 }{ ${s} }`), s;
|
|
1926
1926
|
}
|
|
1927
1927
|
get variables() {
|
|
1928
1928
|
return this.polynom.variables;
|
|
@@ -1937,11 +1937,11 @@ var Ue = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWE
|
|
|
1937
1937
|
const xe = class xe {
|
|
1938
1938
|
constructor(e, t, s) {
|
|
1939
1939
|
// Left part of the equation
|
|
1940
|
-
|
|
1940
|
+
d(this, q);
|
|
1941
1941
|
// Right part of the equation
|
|
1942
|
-
|
|
1942
|
+
d(this, A);
|
|
1943
1943
|
// Signe of the equation
|
|
1944
|
-
|
|
1944
|
+
d(this, re);
|
|
1945
1945
|
// #endregion Constructors (3)
|
|
1946
1946
|
// #region Properties and methods (26)
|
|
1947
1947
|
// ------------------------------------------
|
|
@@ -2046,7 +2046,7 @@ const xe = class xe {
|
|
|
2046
2046
|
a(this, "test", (e) => this.left.evaluate(e).isEqual(this.right.evaluate(e)));
|
|
2047
2047
|
// #endregion Getters And Setters (13)
|
|
2048
2048
|
// #region Private methods (6)
|
|
2049
|
-
|
|
2049
|
+
d(this, Pt, (e) => {
|
|
2050
2050
|
if (e.includes("geq"))
|
|
2051
2051
|
return e.includes("\\geq") ? "\\geq" : "geq";
|
|
2052
2052
|
if (e.includes("leq"))
|
|
@@ -2069,8 +2069,8 @@ const xe = class xe {
|
|
|
2069
2069
|
});
|
|
2070
2070
|
// -----------------------------------------------
|
|
2071
2071
|
// Equations solving algorithms
|
|
2072
|
-
|
|
2073
|
-
|
|
2072
|
+
d(this, Ke, (e) => e === void 0 ? "=" : e.includes("geq") || e.includes(">=") || e.includes("=>") ? ">=" : e.includes(">") ? ">" : e.includes("leq") || e.includes("<=") || e.includes("=<") ? "<=" : e.includes("<") ? "<" : "=");
|
|
2073
|
+
d(this, St, () => i(this, re) === "=" ? this : i(this, re).includes("<") ? (i(this, re).replace("<", ">"), this) : i(this, re).includes(">") ? (i(this, re).replace(">", "<"), this) : this);
|
|
2074
2074
|
if (h(this, q, new T().zero()), h(this, A, new T().zero()), h(this, re, "="), e !== void 0 && t === void 0) {
|
|
2075
2075
|
if (e instanceof xe)
|
|
2076
2076
|
return e.clone();
|
|
@@ -2173,14 +2173,14 @@ const xe = class xe {
|
|
|
2173
2173
|
};
|
|
2174
2174
|
q = new WeakMap(), A = new WeakMap(), re = new WeakMap(), Pt = new WeakMap(), Ke = new WeakMap(), St = new WeakMap();
|
|
2175
2175
|
let H = xe;
|
|
2176
|
-
var N, Ve, lt,
|
|
2176
|
+
var N, Ve, lt, Xt;
|
|
2177
2177
|
const me = class me {
|
|
2178
2178
|
// #endregion Class fields (1)
|
|
2179
2179
|
// #region Constructors (1)
|
|
2180
2180
|
constructor(...e) {
|
|
2181
2181
|
// #region Class fields (1)
|
|
2182
|
-
|
|
2183
|
-
|
|
2182
|
+
d(this, N, []);
|
|
2183
|
+
d(this, Ve, Ue.POWER);
|
|
2184
2184
|
return this.parse(...e), this;
|
|
2185
2185
|
}
|
|
2186
2186
|
// #endregion Constructors (1)
|
|
@@ -2269,7 +2269,7 @@ const me = class me {
|
|
|
2269
2269
|
throw new Error("Method not implemented.");
|
|
2270
2270
|
}
|
|
2271
2271
|
reduce() {
|
|
2272
|
-
const e =
|
|
2272
|
+
const e = Gt(this);
|
|
2273
2273
|
return h(this, N, Object.values(e).map((t) => {
|
|
2274
2274
|
const s = t[0].polynom, r = t.reduce((n, l) => n.add(l.power), new c("0"));
|
|
2275
2275
|
return new fe(s, r.reduce());
|
|
@@ -2297,11 +2297,11 @@ const me = class me {
|
|
|
2297
2297
|
if (e.length === 1)
|
|
2298
2298
|
return e[0];
|
|
2299
2299
|
if (e.length === 2)
|
|
2300
|
-
return M(s = me, lt,
|
|
2300
|
+
return M(s = me, lt, Xt).call(s, e[0], e[1]);
|
|
2301
2301
|
let t = e[0];
|
|
2302
2302
|
return e.shift(), e.forEach((r) => {
|
|
2303
2303
|
var n;
|
|
2304
|
-
return t = M(n = me, lt,
|
|
2304
|
+
return t = M(n = me, lt, Xt).call(n, t, r);
|
|
2305
2305
|
}), t;
|
|
2306
2306
|
}
|
|
2307
2307
|
// #endregion Properties and methods (25)
|
|
@@ -2343,15 +2343,15 @@ const me = class me {
|
|
|
2343
2343
|
}
|
|
2344
2344
|
// #endregion Private methods (1)
|
|
2345
2345
|
};
|
|
2346
|
-
N = new WeakMap(), Ve = new WeakMap(), lt = new WeakSet(),
|
|
2347
|
-
const s =
|
|
2348
|
-
const
|
|
2349
|
-
return new fe(u, c.min(
|
|
2346
|
+
N = new WeakMap(), Ve = new WeakMap(), lt = new WeakSet(), Xt = function(e, t) {
|
|
2347
|
+
const s = Gt(e), r = Gt(t), l = Object.keys(s).filter((u) => Object.hasOwn(r, u)).map((u) => {
|
|
2348
|
+
const f = s[u].reduce((g, E) => g.add(E.power), new c("0")), p = r[u].reduce((g, E) => g.add(E.power), new c("0"));
|
|
2349
|
+
return new fe(u, c.min(f, p));
|
|
2350
2350
|
});
|
|
2351
2351
|
return new me(...l);
|
|
2352
|
-
},
|
|
2353
|
-
let
|
|
2354
|
-
function
|
|
2352
|
+
}, d(me, lt);
|
|
2353
|
+
let Ht = me;
|
|
2354
|
+
function Gt(o) {
|
|
2355
2355
|
const e = new c().one(), t = o.factors.reduce((s, r) => {
|
|
2356
2356
|
if (r.polynom.degree().isZero())
|
|
2357
2357
|
return r.polynom.monoms.length > 0 && e.multiply(r.polynom.monoms[0].coefficient), s;
|
|
@@ -2363,25 +2363,25 @@ function Wt(o) {
|
|
|
2363
2363
|
var k, Ie, Bt, Rt;
|
|
2364
2364
|
const Ge = class Ge {
|
|
2365
2365
|
constructor(...e) {
|
|
2366
|
-
|
|
2366
|
+
d(this, k);
|
|
2367
2367
|
// Determine the letters in the linear system, usually ['x', 'y']
|
|
2368
|
-
|
|
2368
|
+
d(this, Ie);
|
|
2369
2369
|
a(this, "parse", (...e) => (h(this, k, e.map((t) => new H(t))), i(this, Bt).call(this), this));
|
|
2370
2370
|
a(this, "clone", () => new Ge().parse(...i(this, k).map((e) => e.clone())));
|
|
2371
2371
|
a(this, "buildTex", (e, t) => {
|
|
2372
2372
|
let s, r, n = [];
|
|
2373
2373
|
const l = [];
|
|
2374
|
-
for (const
|
|
2375
|
-
n = n.concat(
|
|
2374
|
+
for (const f of e)
|
|
2375
|
+
n = n.concat(f.letters());
|
|
2376
2376
|
n = [...new Set(n)], n.sort();
|
|
2377
|
-
for (let
|
|
2378
|
-
const
|
|
2377
|
+
for (let f = 0; f < e.length; f++) {
|
|
2378
|
+
const p = e[f];
|
|
2379
2379
|
s = [];
|
|
2380
2380
|
for (const g of n)
|
|
2381
|
-
r =
|
|
2382
|
-
if (s.push("="), s.push(
|
|
2381
|
+
r = p.left.monomByLetter(g), s.length === 0 ? s.push(r.isZero() ? "" : r.tex) : s.push(r.isZero() ? "" : (r.coefficient.sign() === 1 ? "+" : "") + r.tex);
|
|
2382
|
+
if (s.push("="), s.push(p.right.tex), (t == null ? void 0 : t[f]) !== void 0) {
|
|
2383
2383
|
s[s.length - 1] = s[s.length - 1] + " \\phantom{\\quad}";
|
|
2384
|
-
for (const g of t[
|
|
2384
|
+
for (const g of t[f])
|
|
2385
2385
|
s.push(`\\ \\cdot\\ ${g.startsWith("-") ? "\\left(" + g + "\\right)" : g}`);
|
|
2386
2386
|
}
|
|
2387
2387
|
l.push(s.join("&"));
|
|
@@ -2408,16 +2408,16 @@ const Ge = class Ge {
|
|
|
2408
2408
|
if (l === r)
|
|
2409
2409
|
continue;
|
|
2410
2410
|
const u = s[l][r].clone().opposite();
|
|
2411
|
-
for (let
|
|
2412
|
-
s[l][
|
|
2413
|
-
if (s[l].slice(0, s[l].length - 1).every((
|
|
2411
|
+
for (let f = 0; f < s[l].length; f++)
|
|
2412
|
+
s[l][f].add(s[r][f].clone().multiply(u));
|
|
2413
|
+
if (s[l].slice(0, s[l].length - 1).every((f) => f.isZero()))
|
|
2414
2414
|
return s[l][s[l].length - 1].isZero() ? [new c().infinite()] : [];
|
|
2415
2415
|
}
|
|
2416
2416
|
}
|
|
2417
2417
|
return s.map((r) => r[r.length - 1]);
|
|
2418
2418
|
});
|
|
2419
|
-
|
|
2420
|
-
|
|
2419
|
+
d(this, Bt, () => (h(this, Ie, i(this, k).reduce((e, t) => [.../* @__PURE__ */ new Set([...e, ...t.variables])], [])), i(this, Ie).sort(), this));
|
|
2420
|
+
d(this, Rt, () => {
|
|
2421
2421
|
const e = [], t = [];
|
|
2422
2422
|
for (const s of i(this, k)) {
|
|
2423
2423
|
const r = [], n = s.clone().reorder();
|
|
@@ -2532,13 +2532,13 @@ const Ge = class Ge {
|
|
|
2532
2532
|
}
|
|
2533
2533
|
};
|
|
2534
2534
|
k = new WeakMap(), Ie = new WeakMap(), Bt = new WeakMap(), Rt = new WeakMap();
|
|
2535
|
-
let
|
|
2536
|
-
function
|
|
2535
|
+
let Yt = Ge;
|
|
2536
|
+
function Vi(o, e) {
|
|
2537
2537
|
return o.dimension === e.dimension && o.array.every(
|
|
2538
2538
|
(t, s) => e.array[s].isEqual(t)
|
|
2539
2539
|
);
|
|
2540
2540
|
}
|
|
2541
|
-
function
|
|
2541
|
+
function Fi(o, e) {
|
|
2542
2542
|
if (o.dimension !== e.dimension)
|
|
2543
2543
|
return !1;
|
|
2544
2544
|
const t = e.array[0].value / o.array[0].value;
|
|
@@ -2546,13 +2546,13 @@ function ji(o, e) {
|
|
|
2546
2546
|
(s, r) => e.array[r].value === s.value * t
|
|
2547
2547
|
);
|
|
2548
2548
|
}
|
|
2549
|
-
function
|
|
2549
|
+
function ji(o, e) {
|
|
2550
2550
|
return o.dimension !== e.dimension ? new c().invalid() : o.array.reduce(
|
|
2551
2551
|
(t, s, r) => t.add(s.clone().multiply(e.array[r])),
|
|
2552
2552
|
new c(0)
|
|
2553
2553
|
);
|
|
2554
2554
|
}
|
|
2555
|
-
function
|
|
2555
|
+
function Ui(...o) {
|
|
2556
2556
|
return o.some((e) => e.dimension !== o[0].dimension) ? new c().invalid() : o[0].dimension === 2 && o.length !== 2 ? new c().invalid() : o[0].dimension === 3 && o.length !== 3 ? new c().invalid() : o[0].dimension === 2 ? o[0].array[0].clone().multiply(o[1].array[1]).subtract(o[0].array[1].clone().multiply(o[1].array[0])) : o[0].array[0].clone().multiply(
|
|
2557
2557
|
o[1].array[1].clone().multiply(o[2].array[2]).subtract(o[1].array[2].clone().multiply(o[2].array[1]))
|
|
2558
2558
|
).subtract(
|
|
@@ -2561,11 +2561,11 @@ function Gi(...o) {
|
|
|
2561
2561
|
)
|
|
2562
2562
|
).add(o[0].array[2].clone().multiply(o[1].array[0].clone().multiply(o[2].array[1]).subtract(o[1].array[1].clone().multiply(o[2].array[0]))));
|
|
2563
2563
|
}
|
|
2564
|
-
var V, ze
|
|
2564
|
+
var V, ze;
|
|
2565
2565
|
const Se = class Se {
|
|
2566
2566
|
constructor(...e) {
|
|
2567
|
-
|
|
2568
|
-
|
|
2567
|
+
d(this, V, []);
|
|
2568
|
+
d(this, ze, !1);
|
|
2569
2569
|
a(this, "zero", () => (i(this, V).forEach((e) => e.zero()), this));
|
|
2570
2570
|
a(this, "one", () => (this.zero(), this.x.one(), this));
|
|
2571
2571
|
a(this, "opposite", () => (i(this, V).forEach((e) => e.opposite()), this));
|
|
@@ -2575,15 +2575,15 @@ const Se = class Se {
|
|
|
2575
2575
|
const e = this.norm;
|
|
2576
2576
|
return e === 0 ? this : this.divideByScalar(e);
|
|
2577
2577
|
});
|
|
2578
|
-
a(this, "dot", (e) =>
|
|
2578
|
+
a(this, "dot", (e) => ji(this, e));
|
|
2579
2579
|
a(this, "normal", () => {
|
|
2580
2580
|
if (this.dimension >= 3)
|
|
2581
2581
|
throw new Error("Normal vector can only be determined in 2D");
|
|
2582
2582
|
const e = this.x.clone().opposite(), t = this.y.clone();
|
|
2583
2583
|
return i(this, V)[0] = t, i(this, V)[1] = e, this;
|
|
2584
2584
|
});
|
|
2585
|
-
a(this, "isEqual", (e) =>
|
|
2586
|
-
a(this, "isColinearTo", (e) =>
|
|
2585
|
+
a(this, "isEqual", (e) => Vi(this, e));
|
|
2586
|
+
a(this, "isColinearTo", (e) => Fi(this, e));
|
|
2587
2587
|
a(this, "isNormalTo", (e) => this.dot(e).isZero());
|
|
2588
2588
|
a(this, "multiplyByScalar", (e) => {
|
|
2589
2589
|
const t = new c(e);
|
|
@@ -2601,7 +2601,7 @@ const Se = class Se {
|
|
|
2601
2601
|
let r = this.dot(e).value;
|
|
2602
2602
|
return t && (r = Math.abs(r)), (s ? 1 : 180 / Math.PI) * Math.acos(r / (this.norm * e.norm));
|
|
2603
2603
|
});
|
|
2604
|
-
|
|
2604
|
+
a(this, "fromString", (e) => {
|
|
2605
2605
|
e.startsWith("(") && (e = e.substring(1)), e.endsWith(")") && (e = e.substring(0, e.length - 1));
|
|
2606
2606
|
const t = e.split(/[,;\s]/g).filter((s) => s.trim() !== "");
|
|
2607
2607
|
return t.length < 2 ? this : (h(this, V, t.map((s) => new c(s))), this);
|
|
@@ -2692,7 +2692,7 @@ const Se = class Se {
|
|
|
2692
2692
|
if (e[0] instanceof Se)
|
|
2693
2693
|
return e[0].clone();
|
|
2694
2694
|
if (typeof e[0] == "string")
|
|
2695
|
-
return
|
|
2695
|
+
return this.fromString(e[0]);
|
|
2696
2696
|
throw new Error("Invalid value");
|
|
2697
2697
|
}
|
|
2698
2698
|
if (e.length === 2) {
|
|
@@ -2746,9 +2746,9 @@ const Se = class Se {
|
|
|
2746
2746
|
};
|
|
2747
2747
|
}
|
|
2748
2748
|
};
|
|
2749
|
-
V = new WeakMap(), ze = new WeakMap()
|
|
2749
|
+
V = new WeakMap(), ze = new WeakMap();
|
|
2750
2750
|
let x = Se;
|
|
2751
|
-
function
|
|
2751
|
+
function mi(o = 0.5) {
|
|
2752
2752
|
return Math.random() < o;
|
|
2753
2753
|
}
|
|
2754
2754
|
function de(o, e, t) {
|
|
@@ -2766,19 +2766,19 @@ function de(o, e, t) {
|
|
|
2766
2766
|
return s;
|
|
2767
2767
|
}
|
|
2768
2768
|
function X(o, e) {
|
|
2769
|
-
return e === !1 ?
|
|
2769
|
+
return e === !1 ? mi() ? de(1, o) : -de(1, o) : de(-o, o);
|
|
2770
2770
|
}
|
|
2771
|
-
function
|
|
2771
|
+
function Gi(o) {
|
|
2772
2772
|
let e = G.primes();
|
|
2773
|
-
return o !== void 0 && (e = e.filter((t) => t < o)),
|
|
2773
|
+
return o !== void 0 && (e = e.filter((t) => t < o)), ei(e);
|
|
2774
2774
|
}
|
|
2775
|
-
function
|
|
2776
|
-
return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) :
|
|
2775
|
+
function Wi(o, e) {
|
|
2776
|
+
return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) : gi(o).slice(0, e);
|
|
2777
2777
|
}
|
|
2778
|
-
function
|
|
2778
|
+
function ei(o) {
|
|
2779
2779
|
return o.length === 0 ? null : o[de(0, o.length - 1)];
|
|
2780
2780
|
}
|
|
2781
|
-
function
|
|
2781
|
+
function gi(o) {
|
|
2782
2782
|
const e = Object.values(o);
|
|
2783
2783
|
for (let t = e.length - 1; t > 0; t--) {
|
|
2784
2784
|
const s = Math.floor(Math.random() * (t + 1)), r = e[t];
|
|
@@ -2786,20 +2786,16 @@ function yi(o) {
|
|
|
2786
2786
|
}
|
|
2787
2787
|
return e;
|
|
2788
2788
|
}
|
|
2789
|
-
class
|
|
2789
|
+
class j extends x {
|
|
2790
2790
|
constructor(...e) {
|
|
2791
2791
|
super(), e.length > 0 && this.parse(...e);
|
|
2792
2792
|
}
|
|
2793
2793
|
parse(...e) {
|
|
2794
|
-
if (this.asPoint = !0, e.length ===
|
|
2794
|
+
if (this.asPoint = !0, e.length === 1) {
|
|
2795
2795
|
if (e[0] instanceof x)
|
|
2796
2796
|
return this.array = e[0].copy(), this;
|
|
2797
|
-
if (typeof e[0] == "string")
|
|
2798
|
-
|
|
2799
|
-
if (t.some((s) => s.isNaN()))
|
|
2800
|
-
throw new Error("The value is not a valid point sting (a,b): " + e[0]);
|
|
2801
|
-
this.array = t;
|
|
2802
|
-
}
|
|
2797
|
+
if (typeof e[0] == "string")
|
|
2798
|
+
return this.fromString(e[0]), this;
|
|
2803
2799
|
}
|
|
2804
2800
|
if (e.length > 1) {
|
|
2805
2801
|
if (e.some((s) => s instanceof x))
|
|
@@ -2812,11 +2808,11 @@ class D extends x {
|
|
|
2812
2808
|
return this;
|
|
2813
2809
|
}
|
|
2814
2810
|
clone() {
|
|
2815
|
-
const e = new
|
|
2811
|
+
const e = new j();
|
|
2816
2812
|
return e.array = this.copy(), e.asPoint = !0, e;
|
|
2817
2813
|
}
|
|
2818
2814
|
}
|
|
2819
|
-
var
|
|
2815
|
+
var yi = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(yi || {}), Ce, B, R, U, ne, Y, $e, ve;
|
|
2820
2816
|
const Le = class Le {
|
|
2821
2817
|
/**
|
|
2822
2818
|
* Value can be a mix of:
|
|
@@ -2824,15 +2820,15 @@ const Le = class Le {
|
|
|
2824
2820
|
* @param values
|
|
2825
2821
|
*/
|
|
2826
2822
|
constructor(...e) {
|
|
2827
|
-
|
|
2823
|
+
d(this, Ce);
|
|
2828
2824
|
// ax + by + c = 0
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2825
|
+
d(this, B);
|
|
2826
|
+
d(this, R);
|
|
2827
|
+
d(this, U);
|
|
2828
|
+
d(this, ne);
|
|
2829
|
+
d(this, Y);
|
|
2830
|
+
d(this, $e);
|
|
2831
|
+
d(this, ve, "canonical");
|
|
2836
2832
|
a(this, "randomPoint", (e) => i(this, Y).clone().multiplyByScalar(X(e === void 0 || e <= 1 ? 3 : e, !1)).add(i(this, ne)));
|
|
2837
2833
|
a(this, "randomNearPoint", (e) => {
|
|
2838
2834
|
const t = this.randomPoint(e);
|
|
@@ -3121,14 +3117,14 @@ const Le = class Le {
|
|
|
3121
3117
|
};
|
|
3122
3118
|
Ce = new WeakMap(), B = new WeakMap(), R = new WeakMap(), U = new WeakMap(), ne = new WeakMap(), Y = new WeakMap(), $e = new WeakMap(), ve = new WeakMap(), // A line is defined as the canonical form
|
|
3123
3119
|
a(Le, "PERPENDICULAR", "perpendicular"), a(Le, "PARALLEL", "parallel");
|
|
3124
|
-
let
|
|
3125
|
-
var oe, F, qe, kt, Lt,
|
|
3126
|
-
const
|
|
3120
|
+
let D = Le;
|
|
3121
|
+
var oe, F, qe, zt, kt, Lt, he, wi, mt, vi, bi, xi, Qt;
|
|
3122
|
+
const Dt = class Dt {
|
|
3127
3123
|
constructor(...e) {
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3124
|
+
d(this, he);
|
|
3125
|
+
d(this, oe);
|
|
3126
|
+
d(this, F);
|
|
3127
|
+
d(this, qe);
|
|
3132
3128
|
/**
|
|
3133
3129
|
* Get the relative position between circle and line. It corresponds to the number of intersection.
|
|
3134
3130
|
* @param {Line} L
|
|
@@ -3147,7 +3143,7 @@ const Zt = class Zt {
|
|
|
3147
3143
|
const s = i(this, qe).clone(), r = e.getEquation().clone().isolate("x"), n = e.getEquation().clone().isolate("y");
|
|
3148
3144
|
return r instanceof H && n instanceof H && (s.replaceBy("y", n.right).simplify(), s.solve()), t;
|
|
3149
3145
|
});
|
|
3150
|
-
a(this, "tangents", (e) => e instanceof c ? i(this,
|
|
3146
|
+
a(this, "tangents", (e) => e instanceof c ? i(this, Lt).call(this, e) : this.isPointOnCircle(e) ? i(this, zt).call(this, e) : i(this, oe) !== void 0 && i(this, oe).distanceTo(e).value > this.radius.value ? i(this, kt).call(this, e) : (console.log("No tangents as the point is inside !"), []));
|
|
3151
3147
|
a(this, "isPointOnCircle", (e) => {
|
|
3152
3148
|
var t;
|
|
3153
3149
|
return ((t = i(this, qe)) == null ? void 0 : t.test({ x: e.x, y: e.y })) ?? !1;
|
|
@@ -3157,29 +3153,33 @@ const Zt = class Zt {
|
|
|
3157
3153
|
return t.forEach((r) => {
|
|
3158
3154
|
for (const n of [[1, 1], [-1, 1], [-1, -1], [1, -1]])
|
|
3159
3155
|
s.push(
|
|
3160
|
-
new
|
|
3156
|
+
new j(
|
|
3161
3157
|
this.center.x.clone().add(n[0] * r[0]),
|
|
3162
3158
|
this.center.y.clone().add(n[1] * r[1])
|
|
3163
3159
|
)
|
|
3164
3160
|
);
|
|
3165
3161
|
}), s;
|
|
3166
3162
|
});
|
|
3167
|
-
|
|
3168
|
-
const t = new
|
|
3169
|
-
return [new
|
|
3163
|
+
d(this, zt, (e) => {
|
|
3164
|
+
const t = new x(this.center, e);
|
|
3165
|
+
return [new D(e, t, yi.Perpendicular)];
|
|
3170
3166
|
});
|
|
3171
|
-
|
|
3167
|
+
d(this, kt, (e) => {
|
|
3172
3168
|
const t = this.center.x.clone().subtract(e.x), s = this.center.y.clone().subtract(e.y), r = new T("x"), n = new T("x^2+1");
|
|
3173
|
-
r.multiply(t).subtract(s).pow(2), n.multiply(this.squareRadius), new H(r, n).
|
|
3169
|
+
return r.multiply(t).subtract(s).pow(2), n.multiply(this.squareRadius), new H(r, n).solve().map((f) => {
|
|
3170
|
+
let p;
|
|
3171
|
+
const g = new H("y", "x");
|
|
3172
|
+
return f.exact instanceof c ? (p = e.x.clone().opposite().multiply(f.exact).add(e.y), g.right.multiply(f.exact).add(p)) : (p = e.x.clone().opposite().multiply(f.value).add(e.y), g.right.multiply(f.value).add(p)), new D(g);
|
|
3173
|
+
});
|
|
3174
3174
|
});
|
|
3175
|
-
|
|
3176
|
-
const t = e.numerator, s = -e.denominator, r = this.center.x.clone(), n = this.center.y.clone(), l = this.squareRadius.clone().multiply(e.numerator ** 2 + e.denominator ** 2), u = r.clone().multiply(t).opposite().subtract(n.clone().multiply(s)).add(l.clone().sqrt()),
|
|
3177
|
-
return [new
|
|
3175
|
+
d(this, Lt, (e) => {
|
|
3176
|
+
const t = e.numerator, s = -e.denominator, r = this.center.x.clone(), n = this.center.y.clone(), l = this.squareRadius.clone().multiply(e.numerator ** 2 + e.denominator ** 2), u = r.clone().multiply(t).opposite().subtract(n.clone().multiply(s)).add(l.clone().sqrt()), f = r.clone().multiply(t).opposite().subtract(n.clone().multiply(s)).subtract(l.clone().sqrt());
|
|
3177
|
+
return [new D(t, s, u), new D(t, s, f)];
|
|
3178
3178
|
});
|
|
3179
3179
|
e.length > 0 && this.parse(...e);
|
|
3180
3180
|
}
|
|
3181
3181
|
get center() {
|
|
3182
|
-
return i(this, oe) ?? new
|
|
3182
|
+
return i(this, oe) ?? new j();
|
|
3183
3183
|
}
|
|
3184
3184
|
get squareRadius() {
|
|
3185
3185
|
return i(this, F) ?? new c(0);
|
|
@@ -3212,7 +3212,7 @@ const Zt = class Zt {
|
|
|
3212
3212
|
return this.center.x.isZero() ? e = "x^2" : e = `(x${this.center.x.isNegative() ? "+" : "-"}${this.center.x.clone().abs().tex})^2`, this.center.y.isZero() ? t = "y^2" : t = `(y${this.center.y.isNegative() ? "+" : "-"}${this.center.y.clone().abs().tex})^2`, `${e}+${t}=${this.squareRadius.display}`;
|
|
3213
3213
|
}
|
|
3214
3214
|
clone() {
|
|
3215
|
-
return new
|
|
3215
|
+
return new Dt(
|
|
3216
3216
|
this.center.clone(),
|
|
3217
3217
|
this.squareRadius.clone(),
|
|
3218
3218
|
!0
|
|
@@ -3222,7 +3222,7 @@ const Zt = class Zt {
|
|
|
3222
3222
|
return t ? h(this, F, new c(e)) : h(this, F, new c(e).pow(2)), M(this, he, mt).call(this), this;
|
|
3223
3223
|
}
|
|
3224
3224
|
parse(...e) {
|
|
3225
|
-
return M(this, he,
|
|
3225
|
+
return M(this, he, wi).call(this), typeof e[0] == "string" ? M(this, he, Qt).call(this, new H(e[0])) : e[0] instanceof H ? M(this, he, Qt).call(this, e[0]) : e[0] instanceof Dt ? M(this, he, vi).call(this, e[0]) : e[0] instanceof j && e.length > 1 && (e[1] instanceof j ? e[2] instanceof j || M(this, he, xi).call(this, e[0], e[1]) : (e[1] instanceof c || typeof e[1] == "number") && M(this, he, bi).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), M(this, he, mt).call(this), this;
|
|
3226
3226
|
}
|
|
3227
3227
|
// private _parseThroughtThreePoints(A: Point, B: Point, C: Point): this {
|
|
3228
3228
|
// const T = new Triangle(A, B, C), mAB = T.remarquables.mediators.AB.clone(),
|
|
@@ -3231,37 +3231,37 @@ const Zt = class Zt {
|
|
|
3231
3231
|
// return this
|
|
3232
3232
|
// }
|
|
3233
3233
|
};
|
|
3234
|
-
oe = new WeakMap(), F = new WeakMap(), qe = new WeakMap(),
|
|
3234
|
+
oe = new WeakMap(), F = new WeakMap(), qe = new WeakMap(), zt = new WeakMap(), kt = new WeakMap(), Lt = new WeakMap(), he = new WeakSet(), wi = function() {
|
|
3235
3235
|
return h(this, oe, void 0), h(this, F, void 0), h(this, qe, void 0), this;
|
|
3236
3236
|
}, mt = function() {
|
|
3237
3237
|
h(this, qe, new H(
|
|
3238
3238
|
new T(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
|
|
3239
3239
|
new T(this.squareRadius.display)
|
|
3240
3240
|
).moveLeft());
|
|
3241
|
-
},
|
|
3241
|
+
}, vi = function(e) {
|
|
3242
3242
|
return h(this, oe, e.center.clone()), h(this, F, e.squareRadius.clone()), M(this, he, mt).call(this), this;
|
|
3243
|
-
},
|
|
3243
|
+
}, bi = function(e, t, s) {
|
|
3244
3244
|
return h(this, oe, e.clone()), s ? h(this, F, new c(t)) : h(this, F, new c(t).pow(2)), this;
|
|
3245
|
-
},
|
|
3245
|
+
}, xi = function(e, t) {
|
|
3246
3246
|
return h(this, oe, e.clone()), h(this, F, new x(i(this, oe), t).normSquare), this;
|
|
3247
|
-
},
|
|
3247
|
+
}, Qt = function(e) {
|
|
3248
3248
|
if (e.moveLeft(), e.degree("x").value === 2 && e.degree("y").value === 2) {
|
|
3249
3249
|
const t = e.left.monomByDegree(2, "x"), s = e.left.monomByDegree(2, "y");
|
|
3250
3250
|
let r, n, l;
|
|
3251
|
-
t.coefficient.isEqual(s.coefficient) ? (e.divide(t.coefficient), r = e.left.monomByDegree(1, "x"), n = e.left.monomByDegree(1, "y"), l = e.left.monomByDegree(0), h(this, oe, new
|
|
3251
|
+
t.coefficient.isEqual(s.coefficient) ? (e.divide(t.coefficient), r = e.left.monomByDegree(1, "x"), n = e.left.monomByDegree(1, "y"), l = e.left.monomByDegree(0), h(this, oe, new j(r.coefficient.clone().divide(2).opposite(), n.coefficient.clone().divide(2).opposite())), h(this, F, l.coefficient.clone().opposite().add(i(this, oe).x.clone().pow(2)).add(i(this, oe).y.clone().pow(2)))) : (h(this, oe, void 0), h(this, F, void 0));
|
|
3252
3252
|
}
|
|
3253
3253
|
return this;
|
|
3254
3254
|
};
|
|
3255
|
-
let yt =
|
|
3256
|
-
var Q, _, ee, Je, Te, ct,
|
|
3257
|
-
const
|
|
3255
|
+
let yt = Dt;
|
|
3256
|
+
var Q, _, ee, Je, Te, ct, Zt, ut, Pe, Vt, _e;
|
|
3257
|
+
const Ft = class Ft {
|
|
3258
3258
|
constructor(...e) {
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3259
|
+
d(this, Q);
|
|
3260
|
+
d(this, _);
|
|
3261
|
+
d(this, ee);
|
|
3262
|
+
d(this, Je);
|
|
3263
|
+
d(this, Te);
|
|
3264
|
+
d(this, ct);
|
|
3265
3265
|
// ------------------------------------------
|
|
3266
3266
|
// Creation / parsing functions
|
|
3267
3267
|
// ------------------------------------------
|
|
@@ -3284,8 +3284,8 @@ const jt = class jt {
|
|
|
3284
3284
|
);
|
|
3285
3285
|
} else if (e.length === 3) {
|
|
3286
3286
|
if (e.every((t) => typeof t == "string"))
|
|
3287
|
-
return this.parse(...e.map((t) => new
|
|
3288
|
-
if (e.every((t) => t instanceof
|
|
3287
|
+
return this.parse(...e.map((t) => new D(t)));
|
|
3288
|
+
if (e.every((t) => t instanceof D)) {
|
|
3289
3289
|
const t = e[0].clone(), s = e[1].clone(), r = e[2].clone();
|
|
3290
3290
|
h(this, Je, { AB: t, BC: s, AC: r });
|
|
3291
3291
|
let n = t.intersection(s);
|
|
@@ -3301,19 +3301,19 @@ const jt = class jt {
|
|
|
3301
3301
|
h(this, Q, n.point.clone());
|
|
3302
3302
|
else
|
|
3303
3303
|
throw new Error("Lines do not intersect !");
|
|
3304
|
-
} else e.every((t) => t instanceof
|
|
3305
|
-
AB: new
|
|
3306
|
-
BC: new
|
|
3307
|
-
AC: new
|
|
3304
|
+
} else e.every((t) => t instanceof j) && (h(this, Q, e[0].clone()), h(this, _, e[1].clone()), h(this, ee, e[2].clone()), h(this, Je, {
|
|
3305
|
+
AB: new D(i(this, Q), i(this, _)),
|
|
3306
|
+
BC: new D(i(this, _), i(this, ee)),
|
|
3307
|
+
AC: new D(i(this, Q), i(this, ee))
|
|
3308
3308
|
}));
|
|
3309
|
-
} else if (e.length === 1 && e[0] instanceof
|
|
3309
|
+
} else if (e.length === 1 && e[0] instanceof Ft)
|
|
3310
3310
|
return e[0].clone();
|
|
3311
|
-
return i(this,
|
|
3311
|
+
return i(this, Zt).call(this), this;
|
|
3312
3312
|
});
|
|
3313
3313
|
/**
|
|
3314
3314
|
* Clone the Triangle class
|
|
3315
3315
|
*/
|
|
3316
|
-
a(this, "clone", () => new
|
|
3316
|
+
a(this, "clone", () => new Ft(
|
|
3317
3317
|
i(this, Q).clone(),
|
|
3318
3318
|
i(this, _).clone(),
|
|
3319
3319
|
i(this, ee).clone()
|
|
@@ -3324,18 +3324,18 @@ const jt = class jt {
|
|
|
3324
3324
|
/**
|
|
3325
3325
|
* Generate the Line object for the three segments of the triangle
|
|
3326
3326
|
*/
|
|
3327
|
-
|
|
3327
|
+
d(this, Zt, () => {
|
|
3328
3328
|
h(this, Te, {
|
|
3329
|
-
AB: new
|
|
3330
|
-
AC: new
|
|
3331
|
-
BC: new
|
|
3332
|
-
}), h(this, ct, i(this,
|
|
3329
|
+
AB: new j().middleOf(i(this, Q), i(this, _)),
|
|
3330
|
+
AC: new j().middleOf(i(this, Q), i(this, ee)),
|
|
3331
|
+
BC: new j().middleOf(i(this, _), i(this, ee))
|
|
3332
|
+
}), h(this, ct, i(this, Vt).call(this));
|
|
3333
3333
|
});
|
|
3334
3334
|
/**
|
|
3335
3335
|
* Get the Vector2D class for the given name
|
|
3336
3336
|
* @param ptName
|
|
3337
3337
|
*/
|
|
3338
|
-
|
|
3338
|
+
d(this, ut, (e) => {
|
|
3339
3339
|
switch (e.toUpperCase()) {
|
|
3340
3340
|
case "A":
|
|
3341
3341
|
return i(this, Q);
|
|
@@ -3351,52 +3351,52 @@ const jt = class jt {
|
|
|
3351
3351
|
* @param ptName1
|
|
3352
3352
|
* @param ptName2
|
|
3353
3353
|
*/
|
|
3354
|
-
|
|
3354
|
+
d(this, Pe, (e, t) => new x(
|
|
3355
3355
|
i(this, ut).call(this, e),
|
|
3356
3356
|
i(this, ut).call(this, t)
|
|
3357
3357
|
));
|
|
3358
|
-
|
|
3358
|
+
d(this, Vt, () => {
|
|
3359
3359
|
const e = {
|
|
3360
|
-
A: new
|
|
3361
|
-
B: new
|
|
3362
|
-
C: new
|
|
3360
|
+
A: new D(i(this, Q), i(this, Te).BC),
|
|
3361
|
+
B: new D(i(this, _), i(this, Te).AC),
|
|
3362
|
+
C: new D(i(this, ee), i(this, Te).AB),
|
|
3363
3363
|
intersection: null
|
|
3364
3364
|
}, t = {
|
|
3365
|
-
AB: new
|
|
3366
|
-
AC: new
|
|
3367
|
-
BC: new
|
|
3365
|
+
AB: new D(i(this, Te).AB, new x(i(this, Q), i(this, _)).normal()),
|
|
3366
|
+
AC: new D(i(this, Te).AC, new x(i(this, Q), i(this, ee)).normal()),
|
|
3367
|
+
BC: new D(i(this, Te).BC, new x(i(this, _), i(this, ee)).normal()),
|
|
3368
3368
|
intersection: null
|
|
3369
3369
|
}, s = {
|
|
3370
|
-
A: new
|
|
3371
|
-
B: new
|
|
3372
|
-
C: new
|
|
3370
|
+
A: new D(i(this, Q), new x(i(this, _), i(this, ee)).normal()),
|
|
3371
|
+
B: new D(i(this, _), new x(i(this, Q), i(this, ee)).normal()),
|
|
3372
|
+
C: new D(i(this, ee), new x(i(this, Q), i(this, _)).normal()),
|
|
3373
3373
|
intersection: null
|
|
3374
3374
|
}, r = i(this, _e).call(this, "A"), n = i(this, _e).call(this, "B"), l = i(this, _e).call(this, "C"), u = {
|
|
3375
3375
|
A: r.internal,
|
|
3376
3376
|
B: n.internal,
|
|
3377
3377
|
C: n.internal,
|
|
3378
3378
|
intersection: null
|
|
3379
|
-
},
|
|
3379
|
+
}, f = {
|
|
3380
3380
|
A: r.external,
|
|
3381
3381
|
B: n.external,
|
|
3382
3382
|
C: l.external,
|
|
3383
3383
|
intersection: null
|
|
3384
|
-
},
|
|
3384
|
+
}, p = {
|
|
3385
3385
|
medians: e,
|
|
3386
3386
|
mediators: t,
|
|
3387
3387
|
heights: s,
|
|
3388
3388
|
bisectors: u,
|
|
3389
|
-
externalBisectors:
|
|
3389
|
+
externalBisectors: f
|
|
3390
3390
|
};
|
|
3391
|
-
return
|
|
3391
|
+
return p.medians.intersection = p.medians.A.intersection(p.medians.B).point, p.mediators.intersection = p.mediators.AB.intersection(p.mediators.BC).point, p.heights.intersection = p.heights.A.intersection(p.heights.B).point, p.bisectors.intersection = p.bisectors.A.intersection(p.bisectors.B).point, p;
|
|
3392
3392
|
});
|
|
3393
|
-
|
|
3393
|
+
d(this, _e, (e) => {
|
|
3394
3394
|
const t = this.lines;
|
|
3395
3395
|
let s, r;
|
|
3396
3396
|
if (e === "A" ? (s = t.AB, r = t.AC) : e === "B" ? (s = t.AB, r = t.BC) : e === "C" && (s = t.BC, r = t.AC), s === void 0 || r === void 0)
|
|
3397
3397
|
throw new Error(`The point ${e} does not exist`);
|
|
3398
|
-
const n = s.n.simplify().norm, l = r.n.simplify().norm, u = s.getEquation().multiply(l),
|
|
3399
|
-
return e === "A" ?
|
|
3398
|
+
const n = s.n.simplify().norm, l = r.n.simplify().norm, u = s.getEquation().multiply(l), f = r.getEquation().multiply(n), p = new D(u.clone().subtract(f).simplify()), g = new D(f.clone().subtract(u).simplify());
|
|
3399
|
+
return e === "A" ? p.hitSegment(this.B, this.C) ? { internal: p, external: g } : { internal: g, external: p } : e === "B" ? p.hitSegment(this.A, this.C) ? { internal: p, external: g } : { internal: g, external: p } : e === "C" ? p.hitSegment(this.B, this.A) ? { internal: p, external: g } : { internal: g, external: p } : { internal: p, external: g };
|
|
3400
3400
|
});
|
|
3401
3401
|
return e.length > 0 && this.parse(...e), this;
|
|
3402
3402
|
}
|
|
@@ -3446,14 +3446,14 @@ const jt = class jt {
|
|
|
3446
3446
|
return i(this, ct);
|
|
3447
3447
|
}
|
|
3448
3448
|
};
|
|
3449
|
-
Q = new WeakMap(), _ = new WeakMap(), ee = new WeakMap(), Je = new WeakMap(), Te = new WeakMap(), ct = new WeakMap(),
|
|
3450
|
-
let
|
|
3449
|
+
Q = new WeakMap(), _ = new WeakMap(), ee = new WeakMap(), Je = new WeakMap(), Te = new WeakMap(), ct = new WeakMap(), Zt = new WeakMap(), ut = new WeakMap(), Pe = new WeakMap(), Vt = new WeakMap(), _e = new WeakMap();
|
|
3450
|
+
let Kt = Ft;
|
|
3451
3451
|
var z, W;
|
|
3452
3452
|
const nt = class nt {
|
|
3453
3453
|
constructor(e, t) {
|
|
3454
3454
|
// ax + by + c = 0
|
|
3455
|
-
|
|
3456
|
-
|
|
3455
|
+
d(this, z, new j());
|
|
3456
|
+
d(this, W, new x());
|
|
3457
3457
|
a(this, "clone", () => (h(this, W, i(this, W).clone()), h(this, z, i(this, z).clone()), this));
|
|
3458
3458
|
// ------------------------------------------
|
|
3459
3459
|
// Mathematical operations
|
|
@@ -3495,7 +3495,7 @@ const nt = class nt {
|
|
|
3495
3495
|
// }
|
|
3496
3496
|
a(this, "randomPoint", (e = 5) => {
|
|
3497
3497
|
const t = i(this, z).clone(), s = new c(X(e, !1));
|
|
3498
|
-
return new
|
|
3498
|
+
return new j(
|
|
3499
3499
|
t.x.clone().add(i(this, W).x.clone().multiply(s)),
|
|
3500
3500
|
t.y.clone().add(i(this, W).y.clone().multiply(s)),
|
|
3501
3501
|
t.z.clone().add(i(this, W).z.clone().multiply(s))
|
|
@@ -3559,10 +3559,10 @@ z = new WeakMap(), W = new WeakMap(), // A line is defined as the canonical form
|
|
|
3559
3559
|
a(nt, "PERPENDICULAR", "perpendicular"), a(nt, "PARALLEL", "parallel");
|
|
3560
3560
|
let wt = nt;
|
|
3561
3561
|
var Ae, Fe;
|
|
3562
|
-
const
|
|
3562
|
+
const ii = class ii {
|
|
3563
3563
|
constructor(e) {
|
|
3564
|
-
|
|
3565
|
-
|
|
3564
|
+
d(this, Ae, new x(0, 0, 1));
|
|
3565
|
+
d(this, Fe, new j(0, 0, 0));
|
|
3566
3566
|
return e && this.parse(e), this;
|
|
3567
3567
|
}
|
|
3568
3568
|
get normal() {
|
|
@@ -3608,23 +3608,23 @@ const si = class si {
|
|
|
3608
3608
|
return;
|
|
3609
3609
|
}
|
|
3610
3610
|
if (e.equation) {
|
|
3611
|
-
const n = e.equation.moveLeft().reduce().left, l = n.monomByLetter("x").coefficient, u = n.monomByLetter("y").coefficient,
|
|
3612
|
-
this.normal = new x(l, u,
|
|
3611
|
+
const n = e.equation.moveLeft().reduce().left, l = n.monomByLetter("x").coefficient, u = n.monomByLetter("y").coefficient, f = n.monomByLetter("z").coefficient, p = n.monomByDegree(0).coefficient;
|
|
3612
|
+
this.normal = new x(l, u, f), l.isNotZero() ? this.point = new j(p.clone().divide(l).opposite(), 0, 0) : u.isNotZero() ? this.point = new j(0, p.clone().divide(u).opposite(), 0) : this.point = new j(0, 0, p.clone().divide(f).opposite());
|
|
3613
3613
|
return;
|
|
3614
3614
|
}
|
|
3615
3615
|
if (((s = e.points) == null ? void 0 : s.length) === 3 && e.points.every((n) => n instanceof x)) {
|
|
3616
|
-
const n = e.points[0], l = e.points[1], u = e.points[2],
|
|
3617
|
-
this.normal =
|
|
3616
|
+
const n = e.points[0], l = e.points[1], u = e.points[2], f = new x(n, l), p = new x(n, u);
|
|
3617
|
+
this.normal = f.cross(p), this.point = n;
|
|
3618
3618
|
return;
|
|
3619
3619
|
}
|
|
3620
3620
|
if (((r = e.coefficients) == null ? void 0 : r.length) === 4) {
|
|
3621
|
-
const [n, l, u,
|
|
3622
|
-
this.normal = new x(n, l, u), this.point = new
|
|
3621
|
+
const [n, l, u, f] = e.coefficients;
|
|
3622
|
+
this.normal = new x(n, l, u), this.point = new j(0, 0, -f);
|
|
3623
3623
|
return;
|
|
3624
3624
|
}
|
|
3625
3625
|
}
|
|
3626
3626
|
angle(e, t, s) {
|
|
3627
|
-
if (e instanceof
|
|
3627
|
+
if (e instanceof ii)
|
|
3628
3628
|
return this.normal.angle(e.normal, t, s);
|
|
3629
3629
|
let r;
|
|
3630
3630
|
if (e instanceof x) {
|
|
@@ -3643,18 +3643,18 @@ const si = class si {
|
|
|
3643
3643
|
return t.clone().add(s.clone().multiplyByScalar(r));
|
|
3644
3644
|
}
|
|
3645
3645
|
intersectWithPlane(e) {
|
|
3646
|
-
throw this.normal.cross(e.normal), new
|
|
3646
|
+
throw this.normal.cross(e.normal), new j(0, 0, 0), new Error("Intersection with plane not yet implemented !");
|
|
3647
3647
|
}
|
|
3648
3648
|
isPointOnPlane(e) {
|
|
3649
3649
|
return this.normal.dot(e).add(this.d).isZero();
|
|
3650
3650
|
}
|
|
3651
3651
|
};
|
|
3652
3652
|
Ae = new WeakMap(), Fe = new WeakMap();
|
|
3653
|
-
let
|
|
3653
|
+
let Jt = ii;
|
|
3654
3654
|
var Me;
|
|
3655
|
-
class
|
|
3655
|
+
class Hi {
|
|
3656
3656
|
constructor(...e) {
|
|
3657
|
-
|
|
3657
|
+
d(this, Me, []);
|
|
3658
3658
|
return h(this, Me, e), this;
|
|
3659
3659
|
}
|
|
3660
3660
|
get values() {
|
|
@@ -3672,7 +3672,7 @@ class Xi {
|
|
|
3672
3672
|
determinant() {
|
|
3673
3673
|
if (!this.isSquare())
|
|
3674
3674
|
throw new Error("Matrix is not square");
|
|
3675
|
-
return
|
|
3675
|
+
return Ui(...this.values);
|
|
3676
3676
|
}
|
|
3677
3677
|
}
|
|
3678
3678
|
Me = new WeakMap();
|
|
@@ -3696,7 +3696,7 @@ function vt(o) {
|
|
|
3696
3696
|
}
|
|
3697
3697
|
return e.reduced ? t.reduce() : t;
|
|
3698
3698
|
}
|
|
3699
|
-
function
|
|
3699
|
+
function Ei(o) {
|
|
3700
3700
|
const e = Object.assign(
|
|
3701
3701
|
{
|
|
3702
3702
|
letters: "x",
|
|
@@ -3714,14 +3714,14 @@ function Ni(o) {
|
|
|
3714
3714
|
for (const s of e.letters.split(""))
|
|
3715
3715
|
t.setLetter(s, 0);
|
|
3716
3716
|
for (let s = 0; s < e.degree; s++) {
|
|
3717
|
-
const r =
|
|
3717
|
+
const r = ei(e.letters.split(""));
|
|
3718
3718
|
t.setLetter(r, t.degree(r).clone().add(1));
|
|
3719
3719
|
}
|
|
3720
3720
|
} else
|
|
3721
3721
|
t.setLetter(e.letters, e.degree);
|
|
3722
3722
|
return t;
|
|
3723
3723
|
}
|
|
3724
|
-
const
|
|
3724
|
+
const Xi = {
|
|
3725
3725
|
letters: "x",
|
|
3726
3726
|
degree: 2,
|
|
3727
3727
|
fraction: !1,
|
|
@@ -3732,14 +3732,14 @@ const Yi = {
|
|
|
3732
3732
|
numberOfMonoms: 0,
|
|
3733
3733
|
positive: !0
|
|
3734
3734
|
};
|
|
3735
|
-
function
|
|
3735
|
+
function Ni(o) {
|
|
3736
3736
|
const e = Object.assign(
|
|
3737
|
-
|
|
3737
|
+
Xi,
|
|
3738
3738
|
o
|
|
3739
3739
|
), t = new T().empty();
|
|
3740
3740
|
let s;
|
|
3741
3741
|
for (let r = e.degree; r >= 0; r--)
|
|
3742
|
-
s =
|
|
3742
|
+
s = Ei({
|
|
3743
3743
|
letters: e.letters,
|
|
3744
3744
|
degree: r,
|
|
3745
3745
|
fraction: e.fraction,
|
|
@@ -3752,7 +3752,7 @@ function Oi(o) {
|
|
|
3752
3752
|
}
|
|
3753
3753
|
return t;
|
|
3754
3754
|
}
|
|
3755
|
-
function
|
|
3755
|
+
function Yi(o) {
|
|
3756
3756
|
const e = Object.assign(
|
|
3757
3757
|
{
|
|
3758
3758
|
letters: "x",
|
|
@@ -3774,7 +3774,7 @@ function Qi(o) {
|
|
|
3774
3774
|
o
|
|
3775
3775
|
), t = new T().one();
|
|
3776
3776
|
for (let s = 0; s < e.degree; s++) {
|
|
3777
|
-
const r =
|
|
3777
|
+
const r = Ni({
|
|
3778
3778
|
degree: 1,
|
|
3779
3779
|
unit: e.unit,
|
|
3780
3780
|
fraction: e.fraction,
|
|
@@ -3785,7 +3785,7 @@ function Qi(o) {
|
|
|
3785
3785
|
}
|
|
3786
3786
|
return new H(t, 0);
|
|
3787
3787
|
}
|
|
3788
|
-
function
|
|
3788
|
+
function Oi(o) {
|
|
3789
3789
|
const e = Object.assign(
|
|
3790
3790
|
{
|
|
3791
3791
|
axis: !0,
|
|
@@ -3795,9 +3795,9 @@ function qi(o) {
|
|
|
3795
3795
|
},
|
|
3796
3796
|
o
|
|
3797
3797
|
), t = e.axis === "x", s = e.axis === "y", r = e.fraction ? vt({ max: e.max, zero: t }) : new c(X(e.max, t)), n = e.fraction ? vt({ max: e.max, zero: s }) : new c(X(e.max, s));
|
|
3798
|
-
return Number(e.quadrant) === 1 && (r.abs(), n.abs()), Number(e.quadrant) === 2 && (r.isPositive() && r.opposite(), n.isNegative() && n.opposite()), Number(e.quadrant) === 3 && (r.isPositive() && r.opposite(), n.isPositive() && n.opposite()), Number(e.quadrant) === 4 && (r.isNegative() && r.opposite(), n.isPositive() && n.opposite()), new
|
|
3798
|
+
return Number(e.quadrant) === 1 && (r.abs(), n.abs()), Number(e.quadrant) === 2 && (r.isPositive() && r.opposite(), n.isNegative() && n.opposite()), Number(e.quadrant) === 3 && (r.isPositive() && r.opposite(), n.isPositive() && n.opposite()), Number(e.quadrant) === 4 && (r.isNegative() && r.opposite(), n.isPositive() && n.opposite()), new j(r, n);
|
|
3799
3799
|
}
|
|
3800
|
-
function
|
|
3800
|
+
function Qi(o) {
|
|
3801
3801
|
const e = Object.assign(
|
|
3802
3802
|
{
|
|
3803
3803
|
center: {
|
|
@@ -3807,11 +3807,11 @@ function Ki(o) {
|
|
|
3807
3807
|
pointsOnCircle: 8
|
|
3808
3808
|
},
|
|
3809
3809
|
o
|
|
3810
|
-
), t =
|
|
3810
|
+
), t = Oi(e.center);
|
|
3811
3811
|
let s, r;
|
|
3812
3812
|
return e.pointsOnCircle === 8 ? (s = de(1, 3), r = s ** 2 + (s + 1) ** 2) : r = de(1, 20), new yt(t, r, !0);
|
|
3813
3813
|
}
|
|
3814
|
-
function
|
|
3814
|
+
function Ki(o) {
|
|
3815
3815
|
const e = Object.assign(
|
|
3816
3816
|
{
|
|
3817
3817
|
A: {
|
|
@@ -3826,9 +3826,9 @@ function Ji(o) {
|
|
|
3826
3826
|
);
|
|
3827
3827
|
for (; t.isNull; )
|
|
3828
3828
|
t.x = X(10), t.y = X(10);
|
|
3829
|
-
return e.slope === 1 ? t.x.sign() !== t.y.sign() && t.y.opposite() : e.slope === -1 && t.x.sign() !== t.y.sign() && t.y.opposite(), new
|
|
3829
|
+
return e.slope === 1 ? t.x.sign() !== t.y.sign() && t.y.opposite() : e.slope === -1 && t.x.sign() !== t.y.sign() && t.y.opposite(), new D(new x(e.A.x, e.A.y), t);
|
|
3830
3830
|
}
|
|
3831
|
-
function
|
|
3831
|
+
function Ji(o) {
|
|
3832
3832
|
const e = Object.assign(
|
|
3833
3833
|
{
|
|
3834
3834
|
A: {
|
|
@@ -3843,48 +3843,48 @@ function _i(o) {
|
|
|
3843
3843
|
}
|
|
3844
3844
|
},
|
|
3845
3845
|
o
|
|
3846
|
-
), t = new
|
|
3846
|
+
), t = new j(e.A.x, e.A.y, e.A.z), s = new x(e.direction.x, e.direction.y, e.direction.z);
|
|
3847
3847
|
return new wt(t, s);
|
|
3848
3848
|
}
|
|
3849
|
-
const
|
|
3850
|
-
equation: (o) =>
|
|
3851
|
-
polynom: (o) =>
|
|
3852
|
-
monom: (o) =>
|
|
3849
|
+
const _i = {
|
|
3850
|
+
equation: (o) => Yi(o),
|
|
3851
|
+
polynom: (o) => Ni(o),
|
|
3852
|
+
monom: (o) => Ei(o),
|
|
3853
3853
|
fraction: (o) => vt(o),
|
|
3854
3854
|
number: (o, e, t) => de(o, e, t),
|
|
3855
3855
|
numberSym: (o, e) => X(o, e),
|
|
3856
|
-
prime: (o) =>
|
|
3857
|
-
bool: (o) =>
|
|
3858
|
-
array: (o, e) =>
|
|
3859
|
-
item: (o) =>
|
|
3860
|
-
shuffle: (o) =>
|
|
3861
|
-
line: (o) =>
|
|
3862
|
-
line3: (o) =>
|
|
3863
|
-
point: (o) =>
|
|
3864
|
-
circle: (o) =>
|
|
3865
|
-
},
|
|
3856
|
+
prime: (o) => Gi(o),
|
|
3857
|
+
bool: (o) => mi(o),
|
|
3858
|
+
array: (o, e) => Wi(o, e),
|
|
3859
|
+
item: (o) => ei(o),
|
|
3860
|
+
shuffle: (o) => gi(o),
|
|
3861
|
+
line: (o) => Ki(o),
|
|
3862
|
+
line3: (o) => Ji(o),
|
|
3863
|
+
point: (o) => Oi(o),
|
|
3864
|
+
circle: (o) => Qi(o)
|
|
3865
|
+
}, es = {
|
|
3866
3866
|
Vector: x,
|
|
3867
|
-
Point:
|
|
3868
|
-
Line:
|
|
3869
|
-
Triangle:
|
|
3867
|
+
Point: j,
|
|
3868
|
+
Line: D,
|
|
3869
|
+
Triangle: Kt,
|
|
3870
3870
|
Circle: yt,
|
|
3871
3871
|
Line3: wt,
|
|
3872
|
-
Plane3:
|
|
3873
|
-
},
|
|
3872
|
+
Plane3: Jt
|
|
3873
|
+
}, is = {
|
|
3874
3874
|
Numeric: G,
|
|
3875
3875
|
Fraction: c,
|
|
3876
3876
|
Root: ft,
|
|
3877
3877
|
Monom: I,
|
|
3878
3878
|
Polynom: T,
|
|
3879
3879
|
Equation: H,
|
|
3880
|
-
Matrix:
|
|
3881
|
-
LinearSystem:
|
|
3880
|
+
Matrix: Hi,
|
|
3881
|
+
LinearSystem: Yt,
|
|
3882
3882
|
Factor: fe,
|
|
3883
|
-
PolyFactor:
|
|
3883
|
+
PolyFactor: Ht,
|
|
3884
3884
|
// LogicalSet,
|
|
3885
|
-
Random:
|
|
3886
|
-
Geometry:
|
|
3885
|
+
Random: _i,
|
|
3886
|
+
Geometry: es
|
|
3887
3887
|
};
|
|
3888
3888
|
export {
|
|
3889
|
-
|
|
3889
|
+
is as default
|
|
3890
3890
|
};
|