pimath 0.2.9 → 0.2.11
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 +95 -61
- package/dist/pimath.js.map +1 -1
- package/package.json +12 -12
- package/src/algebra/matrix.ts +45 -8
- package/src/algebra/polyFactor.ts +6 -3
- package/src/coefficients/root.ts +1 -1
- package/src/randomization/algebra/rndMonom.ts +16 -10
- package/src/randomization/geometry/rndCircle.ts +5 -5
- package/src/randomization/geometry/{rndVector.ts → rndPoint.ts} +6 -6
- package/src/randomization/random.ts +4 -4
- package/types/algebra/matrix.d.ts +5 -0
- package/types/algebra/matrix.d.ts.map +1 -1
- package/types/algebra/polyFactor.d.ts +1 -1
- package/types/algebra/polyFactor.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/randomization/algebra/rndMonom.d.ts.map +1 -1
- package/types/randomization/geometry/rndCircle.d.ts.map +1 -1
- package/types/randomization/geometry/rndPoint.d.ts +4 -0
- package/types/randomization/geometry/rndPoint.d.ts.map +1 -0
- package/types/randomization/random.d.ts +3 -3
- package/types/randomization/random.d.ts.map +1 -1
package/dist/pimath.js
CHANGED
|
@@ -1816,7 +1816,7 @@ var v = class e {
|
|
|
1816
1816
|
#e;
|
|
1817
1817
|
#t;
|
|
1818
1818
|
constructor(e) {
|
|
1819
|
-
e instanceof M || e instanceof A ?
|
|
1819
|
+
this.#e = e instanceof M || e instanceof A ? new M(e) : new M().fromPolynom(e), this.#t = this.#e.getRoots();
|
|
1820
1820
|
}
|
|
1821
1821
|
get fx() {
|
|
1822
1822
|
return this.#e;
|
|
@@ -1983,7 +1983,11 @@ var v = class e {
|
|
|
1983
1983
|
}, x = {
|
|
1984
1984
|
pi: Math.PI,
|
|
1985
1985
|
e: Math.exp(1)
|
|
1986
|
-
}, S = /* @__PURE__ */
|
|
1986
|
+
}, S = /* @__PURE__ */ function(e) {
|
|
1987
|
+
return e.VARIABLE = "variable", e.COEFFICIENT = "coefficient", e.OPERATION = "operation", e.CONSTANT = "constant", e.FUNCTION = "function", e.FUNCTION_ARGUMENT = "function-argument", e.MONOM = "monom", e.LEFT_PARENTHESIS = "(", e.RIGHT_PARENTHESIS = ")", e;
|
|
1988
|
+
}({}), C = /* @__PURE__ */ function(e) {
|
|
1989
|
+
return e.EXPRESSION = "expression", e.POLYNOM = "polynom", e.SET = "set", e.NUMERIC = "numeric", e;
|
|
1990
|
+
}({});
|
|
1987
1991
|
function te(e, t) {
|
|
1988
1992
|
if (e.length <= 1) return e;
|
|
1989
1993
|
let n = Object.keys(t).filter((e) => t[e].type === S.FUNCTION).map((e) => e);
|
|
@@ -2115,6 +2119,11 @@ var re = {
|
|
|
2115
2119
|
associative: "right",
|
|
2116
2120
|
type: S.FUNCTION
|
|
2117
2121
|
},
|
|
2122
|
+
logn: {
|
|
2123
|
+
precedence: 4,
|
|
2124
|
+
associative: "right",
|
|
2125
|
+
type: S.FUNCTION
|
|
2126
|
+
},
|
|
2118
2127
|
",": {
|
|
2119
2128
|
precedence: 2,
|
|
2120
2129
|
associative: "left",
|
|
@@ -2181,6 +2190,11 @@ var re = {
|
|
|
2181
2190
|
associative: "right",
|
|
2182
2191
|
type: S.FUNCTION
|
|
2183
2192
|
},
|
|
2193
|
+
logn: {
|
|
2194
|
+
precedence: 4,
|
|
2195
|
+
associative: "right",
|
|
2196
|
+
type: S.FUNCTION
|
|
2197
|
+
},
|
|
2184
2198
|
log: {
|
|
2185
2199
|
precedence: 4,
|
|
2186
2200
|
associative: "right",
|
|
@@ -2214,7 +2228,7 @@ var re = {
|
|
|
2214
2228
|
#r = [];
|
|
2215
2229
|
#i;
|
|
2216
2230
|
constructor(e) {
|
|
2217
|
-
this.#e =
|
|
2231
|
+
this.#e = e === void 0 ? C.POLYNOM : e, this.tokenConfigInitialization();
|
|
2218
2232
|
}
|
|
2219
2233
|
get rpn() {
|
|
2220
2234
|
return this.#t;
|
|
@@ -2347,7 +2361,7 @@ var re = {
|
|
|
2347
2361
|
try {
|
|
2348
2362
|
this._rpn = new w(C.NUMERIC).parse(e, t).rpn;
|
|
2349
2363
|
} catch (t) {
|
|
2350
|
-
throw this._rpn = null, this._isValid = !1, console.warn(t),
|
|
2364
|
+
throw this._rpn = null, this._isValid = !1, console.warn(t), Error(`There was a problem parsing: ${e}`);
|
|
2351
2365
|
}
|
|
2352
2366
|
}
|
|
2353
2367
|
get rpn() {
|
|
@@ -2356,8 +2370,8 @@ var re = {
|
|
|
2356
2370
|
get isValid() {
|
|
2357
2371
|
if (this._isValid === void 0) try {
|
|
2358
2372
|
this.evaluate({ x: 2 });
|
|
2359
|
-
} catch {
|
|
2360
|
-
this._isValid = !1;
|
|
2373
|
+
} catch (e) {
|
|
2374
|
+
e instanceof Error, this._isValid = !1;
|
|
2361
2375
|
}
|
|
2362
2376
|
return this._isValid ?? !1;
|
|
2363
2377
|
}
|
|
@@ -2374,7 +2388,7 @@ var re = {
|
|
|
2374
2388
|
for (let n of this._rpn) if (n.tokenType === S.COEFFICIENT) if (!isNaN(+n.token)) t.push(+n.token);
|
|
2375
2389
|
else {
|
|
2376
2390
|
let e = n.token.split("/");
|
|
2377
|
-
if (e.length !== 2) throw this._isValid = !1,
|
|
2391
|
+
if (e.length !== 2) throw this._isValid = !1, Error("This coefficient is not a fraction");
|
|
2378
2392
|
t.push(e[0] / +e[1]);
|
|
2379
2393
|
}
|
|
2380
2394
|
else if (n.tokenType === S.VARIABLE && e !== void 0) Object.hasOwn(e, n.token) && t.push(+e[n.token]);
|
|
@@ -2382,37 +2396,43 @@ var re = {
|
|
|
2382
2396
|
else if (n.tokenType === S.OPERATION) {
|
|
2383
2397
|
if (n.token === "*") {
|
|
2384
2398
|
let e = t.pop(), n = t.pop();
|
|
2385
|
-
if (n === void 0 || e === void 0) throw this._isValid = !1,
|
|
2399
|
+
if (n === void 0 || e === void 0) throw this._isValid = !1, Error(`The multiplication factors ${n ?? "a"} or ${e ?? "b"} are not defined`);
|
|
2386
2400
|
t.push(n * e);
|
|
2387
2401
|
} else if (n.token === "/") {
|
|
2388
2402
|
let e = t.pop(), n = t.pop();
|
|
2389
|
-
if (n === void 0 || e === void 0) throw this._isValid = !1,
|
|
2403
|
+
if (n === void 0 || e === void 0) throw this._isValid = !1, Error(`The division values ${n ?? "a"} or ${e ?? "b"} are not defined`);
|
|
2390
2404
|
t.push(n / e);
|
|
2391
2405
|
} else if (n.token === "+") {
|
|
2392
2406
|
let e = t.pop(), n = t.pop();
|
|
2393
|
-
if (n === void 0 || e === void 0) throw this._isValid = !1,
|
|
2407
|
+
if (n === void 0 || e === void 0) throw this._isValid = !1, Error(`The addition values ${n ?? "a"} or ${e ?? "b"} are not defined`);
|
|
2394
2408
|
t.push(+n + +e);
|
|
2395
2409
|
} else if (n.token === "-") {
|
|
2396
2410
|
let e = t.pop(), n = t.pop() ?? 0;
|
|
2397
|
-
if (e === void 0) throw this._isValid = !1,
|
|
2411
|
+
if (e === void 0) throw this._isValid = !1, Error("The subtraction value b is not defined");
|
|
2398
2412
|
t.push(n - e);
|
|
2399
2413
|
} else if (n.token === "^") {
|
|
2400
2414
|
let e = t.pop(), n = t.pop();
|
|
2401
|
-
if (n === void 0 || e === void 0) throw this._isValid = !1,
|
|
2415
|
+
if (n === void 0 || e === void 0) throw this._isValid = !1, Error(`The base value ${n ?? "a"} or exponent ${e ?? "b"} are not defined`);
|
|
2402
2416
|
t.push(n ** +e);
|
|
2403
2417
|
}
|
|
2404
2418
|
} else if (n.tokenType === S.FUNCTION) {
|
|
2405
2419
|
let e = t.pop();
|
|
2406
|
-
if (e === void 0) throw this._isValid = !1,
|
|
2420
|
+
if (e === void 0) throw this._isValid = !1, Error(`The parameters for ${n.token} is not defined`);
|
|
2407
2421
|
if (n.token === "sin") t.push(Math.sin(e));
|
|
2408
2422
|
else if (n.token === "cos") t.push(Math.cos(e));
|
|
2409
2423
|
else if (n.token === "tan") t.push(Math.tan(e));
|
|
2410
2424
|
else if (n.token === "sqrt") t.push(Math.sqrt(e));
|
|
2411
2425
|
else if (n.token === "nthrt") {
|
|
2412
2426
|
let n = t.pop();
|
|
2413
|
-
if (n === void 0) throw this._isValid = !1,
|
|
2427
|
+
if (n === void 0) throw this._isValid = !1, Error("The nthrt function requires two parameters");
|
|
2414
2428
|
e % 2 == 0 && n < 0 ? t.push(NaN) : t.push((n < 0 ? -1 : 1) * Math.abs(n) ** (1 / e));
|
|
2415
|
-
} else n.token === "ln"
|
|
2429
|
+
} else if (n.token === "ln") t.push(Math.log(e));
|
|
2430
|
+
else if (n.token === "log") t.push(Math.log10(e));
|
|
2431
|
+
else if (n.token === "logn") {
|
|
2432
|
+
let n = t.pop();
|
|
2433
|
+
if (n === void 0) throw this._isValid = !1, Error("The logn function requires two parameters");
|
|
2434
|
+
e <= 0 || e === 1 || n <= 0 ? t.push(NaN) : t.push(Math.log(n) / Math.log(e));
|
|
2435
|
+
}
|
|
2416
2436
|
}
|
|
2417
2437
|
if (t.length === 1) return this._numberCorrection(t[0]);
|
|
2418
2438
|
throw Error(`There was a problem parsing: ${this._expression}`);
|
|
@@ -2476,7 +2496,8 @@ var re = {
|
|
|
2476
2496
|
if (this.hasVariable(t)) {
|
|
2477
2497
|
let e = this.#t[t].clone(), n = this.clone();
|
|
2478
2498
|
return n.#t[t].subtract(1), n.#e.multiply(new p(e.clone())), n;
|
|
2479
|
-
}
|
|
2499
|
+
}
|
|
2500
|
+
return new e().zero();
|
|
2480
2501
|
};
|
|
2481
2502
|
divide = (...t) => {
|
|
2482
2503
|
for (let n of t) {
|
|
@@ -2684,9 +2705,7 @@ var re = {
|
|
|
2684
2705
|
case "/":
|
|
2685
2706
|
i = t.pop() ?? new e().one(), r = t.pop() ?? new e().one(), t.push(r.divide(i));
|
|
2686
2707
|
break;
|
|
2687
|
-
case "^":
|
|
2688
|
-
s = t.pop()?.coefficient ?? new p().one(), a = t.pop() ?? new e().one(), o = a.variables[0], o && a.setLetter(o, s), t.push(a);
|
|
2689
|
-
break;
|
|
2708
|
+
case "^": s = t.pop()?.coefficient ?? new p().one(), a = t.pop() ?? new e().one(), o = a.variables[0], o && a.setLetter(o, s), t.push(a);
|
|
2690
2709
|
}
|
|
2691
2710
|
};
|
|
2692
2711
|
#s = (e) => {
|
|
@@ -2695,7 +2714,8 @@ var re = {
|
|
|
2695
2714
|
if (t.length === 1) {
|
|
2696
2715
|
let e = t[0];
|
|
2697
2716
|
return this.one(), e.tokenType === S.COEFFICIENT ? this.coefficient = new p(e.token) : e.tokenType === S.VARIABLE && this.setLetter(e.token, 1), this;
|
|
2698
|
-
}
|
|
2717
|
+
}
|
|
2718
|
+
for (let e of t) this.#o(n, e);
|
|
2699
2719
|
return this.one(), this.multiply(n[0]), this;
|
|
2700
2720
|
};
|
|
2701
2721
|
};
|
|
@@ -2881,7 +2901,8 @@ var O = class e {
|
|
|
2881
2901
|
if (e.degree().isOne()) {
|
|
2882
2902
|
let t = e.getZeroes()[0];
|
|
2883
2903
|
return t.exact ? this.evaluate(t.fraction).isZero() : !1;
|
|
2884
|
-
}
|
|
2904
|
+
}
|
|
2905
|
+
{
|
|
2885
2906
|
let { reminder: t } = this.euclidean(e);
|
|
2886
2907
|
return t.isZero();
|
|
2887
2908
|
}
|
|
@@ -3117,7 +3138,8 @@ var O = class e {
|
|
|
3117
3138
|
return this.add(t), this;
|
|
3118
3139
|
}
|
|
3119
3140
|
return this.#_(e);
|
|
3120
|
-
}
|
|
3141
|
+
}
|
|
3142
|
+
if (/^[a-z]+$/.test(e)) {
|
|
3121
3143
|
this.empty();
|
|
3122
3144
|
let n = t.map((e) => new p(e));
|
|
3123
3145
|
if (e.length > 1) {
|
|
@@ -3136,7 +3158,8 @@ var O = class e {
|
|
|
3136
3158
|
}
|
|
3137
3159
|
}
|
|
3138
3160
|
return this;
|
|
3139
|
-
}
|
|
3161
|
+
}
|
|
3162
|
+
return this.zero();
|
|
3140
3163
|
}
|
|
3141
3164
|
#g(t, n) {
|
|
3142
3165
|
switch (n.tokenType) {
|
|
@@ -3209,7 +3232,7 @@ var O = class e {
|
|
|
3209
3232
|
return e.includes("=") || e.includes("<") || e.includes(">") || e.includes("<=") || e.includes(">=");
|
|
3210
3233
|
}
|
|
3211
3234
|
static makeSolutionsUnique(e, t) {
|
|
3212
|
-
let n = [], r = e.filter((e) => n.includes(e.tex)
|
|
3235
|
+
let n = [], r = e.filter((e) => !n.includes(e.tex) && (n.push(e.tex), !0));
|
|
3213
3236
|
return t === !0 && r.sort((e, t) => e.value - t.value), r;
|
|
3214
3237
|
}
|
|
3215
3238
|
add(t) {
|
|
@@ -3689,15 +3712,13 @@ var O = class e {
|
|
|
3689
3712
|
}));
|
|
3690
3713
|
}
|
|
3691
3714
|
break;
|
|
3692
|
-
case "!":
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
}
|
|
3700
|
-
break;
|
|
3715
|
+
case "!": if (e.length >= 1) {
|
|
3716
|
+
let t = e.pop();
|
|
3717
|
+
t && e.push({
|
|
3718
|
+
token: `\\overline{ ${t.token} }`,
|
|
3719
|
+
tokenType: "variable"
|
|
3720
|
+
});
|
|
3721
|
+
}
|
|
3701
3722
|
}
|
|
3702
3723
|
return e[0].token;
|
|
3703
3724
|
}
|
|
@@ -3800,12 +3821,10 @@ var O = class e {
|
|
|
3800
3821
|
t && e && n.push(new Set([...t].filter((t) => !e.has(t))));
|
|
3801
3822
|
}
|
|
3802
3823
|
break;
|
|
3803
|
-
case "!":
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
}
|
|
3808
|
-
break;
|
|
3824
|
+
case "!": if (n.length >= 1) {
|
|
3825
|
+
let e = n.pop();
|
|
3826
|
+
e && n.push(new Set([...r].filter((t) => !e.has(t))));
|
|
3827
|
+
}
|
|
3809
3828
|
}
|
|
3810
3829
|
return [...n[0]].sort();
|
|
3811
3830
|
}
|
|
@@ -3817,6 +3836,7 @@ var O = class e {
|
|
|
3817
3836
|
}
|
|
3818
3837
|
parse(...t) {
|
|
3819
3838
|
return this.#t = [], t.length === 0 || t.forEach((t) => {
|
|
3839
|
+
if (typeof t == "string") return this.fromString(t);
|
|
3820
3840
|
t instanceof e ? this.#t.push(...t.factors.map((e) => e.clone())) : this.#t.push(new A(t));
|
|
3821
3841
|
}), this;
|
|
3822
3842
|
}
|
|
@@ -3937,7 +3957,7 @@ var O = class e {
|
|
|
3937
3957
|
let [t, ...n] = _(e, "/");
|
|
3938
3958
|
if (t === "") throw Error("Parsing a PolyFactor from a string requires a numerator");
|
|
3939
3959
|
if (n.length > 1) throw Error("Parsing a PolyFactor from a string only allows max one signe \"/\"");
|
|
3940
|
-
return n.length === 0 ?
|
|
3960
|
+
return this.#t = n.length === 0 ? A.factorsFromString(h(t), !0) : [...A.factorsFromString(h(t), !0), ...A.factorsFromString(h(n[0]), !1)], this;
|
|
3941
3961
|
}
|
|
3942
3962
|
getRoots() {
|
|
3943
3963
|
return [];
|
|
@@ -3962,9 +3982,10 @@ var O = class e {
|
|
|
3962
3982
|
isZero() {
|
|
3963
3983
|
return this.#t.every((e) => e.isZero());
|
|
3964
3984
|
}
|
|
3965
|
-
multiply(...
|
|
3966
|
-
return
|
|
3967
|
-
|
|
3985
|
+
multiply(...t) {
|
|
3986
|
+
return t.forEach((t) => {
|
|
3987
|
+
let n = new e(t);
|
|
3988
|
+
this.#t = this.#t.concat(n.factors);
|
|
3968
3989
|
}), this;
|
|
3969
3990
|
}
|
|
3970
3991
|
get numerator() {
|
|
@@ -4038,9 +4059,7 @@ var O = class e {
|
|
|
4038
4059
|
case "h":
|
|
4039
4060
|
e[n] = "h";
|
|
4040
4061
|
break;
|
|
4041
|
-
case "-":
|
|
4042
|
-
e[n] = e[n] === "h" ? "h" : e[n] === "-" ? "+" : "-";
|
|
4043
|
-
break;
|
|
4062
|
+
case "-": e[n] = e[n] === "h" ? "h" : e[n] === "-" ? "+" : "-";
|
|
4044
4063
|
}
|
|
4045
4064
|
}), e), []),
|
|
4046
4065
|
roots: e,
|
|
@@ -4076,7 +4095,7 @@ function N(e) {
|
|
|
4076
4095
|
//#region src/algebra/matrix.ts
|
|
4077
4096
|
var le = class e {
|
|
4078
4097
|
#e = null;
|
|
4079
|
-
#t =
|
|
4098
|
+
#t = 0;
|
|
4080
4099
|
#n = [];
|
|
4081
4100
|
constructor(e, t) {
|
|
4082
4101
|
return e && (t ??= e, this.fromDimensions(e, t)), this;
|
|
@@ -4095,16 +4114,22 @@ var le = class e {
|
|
|
4095
4114
|
}
|
|
4096
4115
|
get tex() {
|
|
4097
4116
|
if (this.#n.length === 0) return "";
|
|
4098
|
-
let e = this
|
|
4117
|
+
let e = this.resolveTeXwrapper(), t = [
|
|
4099
4118
|
`\\begin{${e}}`,
|
|
4100
4119
|
...this.rows.map((e) => " " + e.map((e) => this.#e !== null && e.value ? +e.value.toFixed(this.#e) : e.tex).join(" & ") + "\\\\"),
|
|
4101
4120
|
`\\end{${e}}`
|
|
4102
4121
|
].join("\n");
|
|
4103
4122
|
return this.#e = null, t;
|
|
4104
4123
|
}
|
|
4124
|
+
resolveWrapper() {
|
|
4125
|
+
return this.#t === 3 ? ["|", "|"] : this.#t === 4 ? ["||", "||"] : this.#t === 1 ? ["[", "]"] : this.#t === 2 ? ["{", "}"] : ["(", ")"];
|
|
4126
|
+
}
|
|
4127
|
+
resolveTeXwrapper() {
|
|
4128
|
+
return this.#t === 3 ? "vmatrix" : this.#t === 4 ? "Vmatrix" : this.#t === 1 ? "bmatrix" : this.#t === 2 ? "Bmatrix" : "pmatrix";
|
|
4129
|
+
}
|
|
4105
4130
|
get display() {
|
|
4106
4131
|
if (this.#n.length === 0) return "";
|
|
4107
|
-
let e = this
|
|
4132
|
+
let e = this.resolveWrapper(), t = e[0] + this.map((e) => this.#e !== null && e.value ? +e.value.toFixed(this.#e) : e.display).map((e) => `(${e.join(",")})`).join(",") + e[1];
|
|
4108
4133
|
return this.#e = null, t;
|
|
4109
4134
|
}
|
|
4110
4135
|
add(e) {
|
|
@@ -4117,7 +4142,10 @@ var le = class e {
|
|
|
4117
4142
|
return e < 0 || e > this.dimension.rows || t < 0 || t > this.dimension.cols ? null : this.#n[e][t];
|
|
4118
4143
|
}
|
|
4119
4144
|
get bmatrix() {
|
|
4120
|
-
return this.#t =
|
|
4145
|
+
return this.#t = 1, this;
|
|
4146
|
+
}
|
|
4147
|
+
get Bmatrix() {
|
|
4148
|
+
return this.#t = 2, this;
|
|
4121
4149
|
}
|
|
4122
4150
|
canBeAdded(e) {
|
|
4123
4151
|
let { rows: t, cols: n } = this.dimension, { rows: r, cols: i } = e.dimension;
|
|
@@ -4257,7 +4285,13 @@ var le = class e {
|
|
|
4257
4285
|
}), this;
|
|
4258
4286
|
}
|
|
4259
4287
|
get pmatrix() {
|
|
4260
|
-
return this.#t =
|
|
4288
|
+
return this.#t = 0, this;
|
|
4289
|
+
}
|
|
4290
|
+
get vmatrix() {
|
|
4291
|
+
return this.#t = 3, this;
|
|
4292
|
+
}
|
|
4293
|
+
get Vmatrix() {
|
|
4294
|
+
return this.#t = 4, this;
|
|
4261
4295
|
}
|
|
4262
4296
|
pow(e) {
|
|
4263
4297
|
return D(this, e);
|
|
@@ -5060,7 +5094,7 @@ var G = class e {
|
|
|
5060
5094
|
return this.#e = e.clone(), this.#r = new L(this.#e, t).normSquare, this.#i(), this;
|
|
5061
5095
|
}
|
|
5062
5096
|
fromCenterRadius(e, t, n) {
|
|
5063
|
-
return this.#e = e.clone(),
|
|
5097
|
+
return this.#e = e.clone(), this.#r = n ? new p(t) : new p(t).pow(2), this.#i(), this;
|
|
5064
5098
|
}
|
|
5065
5099
|
fromEquation(e) {
|
|
5066
5100
|
if (e.moveLeft(), e.degree("x").value === 2 && e.degree("y").value === 2) {
|
|
@@ -5120,7 +5154,7 @@ var G = class e {
|
|
|
5120
5154
|
return t - n > 1e-10 ? 0 : Math.abs(t - n) < 1e-10 ? 1 : 2;
|
|
5121
5155
|
}
|
|
5122
5156
|
setRadius(e, t) {
|
|
5123
|
-
return
|
|
5157
|
+
return this.#r = t ? new p(e) : new p(e).pow(2), this.#i(), this;
|
|
5124
5158
|
}
|
|
5125
5159
|
get squareRadius() {
|
|
5126
5160
|
return this.#r?.clone() ?? new p(-1);
|
|
@@ -5247,7 +5281,7 @@ var G = class e {
|
|
|
5247
5281
|
}
|
|
5248
5282
|
if (e.equation) {
|
|
5249
5283
|
let t = e.equation.moveLeft().reduce().left, n = t.monomByLetter("x").coefficient, r = t.monomByLetter("y").coefficient, i = t.monomByLetter("z").coefficient, a = t.monomByDegree(0).coefficient;
|
|
5250
|
-
this.normal = new L(n, r, i), n.isNotZero() ?
|
|
5284
|
+
this.normal = new L(n, r, i), this.point = n.isNotZero() ? new I(a.clone().divide(n).opposite(), 0, 0) : r.isNotZero() ? new I(0, a.clone().divide(r).opposite(), 0) : new I(0, 0, a.clone().divide(i).opposite());
|
|
5251
5285
|
return;
|
|
5252
5286
|
}
|
|
5253
5287
|
if (e.points?.length === 3 && e.points.every((e) => e instanceof L)) {
|
|
@@ -5412,7 +5446,7 @@ function Y(e) {
|
|
|
5412
5446
|
zero: !0,
|
|
5413
5447
|
natural: !1
|
|
5414
5448
|
}, e), n = new p();
|
|
5415
|
-
if (t.negative ?
|
|
5449
|
+
if (n.numerator = t.negative ? H(t.max, t.zero) : V(+!t.zero, t.max), t.natural) n.denominator = 1;
|
|
5416
5450
|
else {
|
|
5417
5451
|
let e = 0;
|
|
5418
5452
|
for (; n.isRelative() && e < 10;) n.denominator = V(1, t.max), e++;
|
|
@@ -5428,11 +5462,11 @@ function ye(e) {
|
|
|
5428
5462
|
fraction: !0,
|
|
5429
5463
|
zero: !1
|
|
5430
5464
|
}, e), n = new E();
|
|
5431
|
-
if (n.coefficient = Y({
|
|
5465
|
+
if (n.coefficient = Y(Object.assign({}, {
|
|
5432
5466
|
zero: t.zero,
|
|
5433
5467
|
reduced: !0,
|
|
5434
|
-
natural:
|
|
5435
|
-
}), t.letters.length > 1) {
|
|
5468
|
+
natural: t.fraction === !1
|
|
5469
|
+
}, typeof t.fraction == "boolean" ? {} : t.fraction)), t.letters.length > 1) {
|
|
5436
5470
|
for (let e of t.letters.split("")) n.setLetter(e, 0);
|
|
5437
5471
|
for (let e = 0; e < t.degree; e++) {
|
|
5438
5472
|
let e = U(t.letters.split(""));
|
|
@@ -5515,7 +5549,7 @@ function xe(e) {
|
|
|
5515
5549
|
return new k(n, 0);
|
|
5516
5550
|
}
|
|
5517
5551
|
//#endregion
|
|
5518
|
-
//#region src/randomization/geometry/
|
|
5552
|
+
//#region src/randomization/geometry/rndPoint.ts
|
|
5519
5553
|
function Q(e) {
|
|
5520
5554
|
let t = Object.assign({
|
|
5521
5555
|
axis: !0,
|
|
@@ -5593,8 +5627,8 @@ var $ = {
|
|
|
5593
5627
|
shuffle: (e) => W(e),
|
|
5594
5628
|
line: (e) => Ce(e),
|
|
5595
5629
|
line3: (e) => we(e),
|
|
5596
|
-
vector: (e) => Q(e),
|
|
5597
|
-
point: (e) =>
|
|
5630
|
+
vector: (e) => new L(Q(e)),
|
|
5631
|
+
point: (e) => Q(e),
|
|
5598
5632
|
circle: (e) => Se(e)
|
|
5599
5633
|
}, Te = {
|
|
5600
5634
|
Numeric: d,
|