pimath 0.1.36 → 0.1.37
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 +15 -15
- package/dist/pimath.js.map +1 -1
- package/package.json +1 -1
- package/types/algebra/polynom.d.ts.map +1 -1
package/dist/pimath.js
CHANGED
|
@@ -594,7 +594,7 @@ class J {
|
|
|
594
594
|
}
|
|
595
595
|
var Ce = Object.defineProperty, ue = (n) => {
|
|
596
596
|
throw TypeError(n);
|
|
597
|
-
}, ke = (n, e, t) => e in n ? Ce(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ie = (n, e, t) => ke(n, typeof e != "symbol" ? e + "" : e, t), fe = (n, e, t) => e.has(n) || ue("Cannot " + t), O = (n, e, t) => (fe(n, e, "read from private field"), t ? t.call(n) : e.get(n)), j = (n, e, t) => e.has(n) ? ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t),
|
|
597
|
+
}, ke = (n, e, t) => e in n ? Ce(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ie = (n, e, t) => ke(n, typeof e != "symbol" ? e + "" : e, t), fe = (n, e, t) => e.has(n) || ue("Cannot " + t), O = (n, e, t) => (fe(n, e, "read from private field"), t ? t.call(n) : e.get(n)), j = (n, e, t) => e.has(n) ? ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), I = (n, e, t, i) => (fe(n, e, "write to private field"), e.set(n, t), t);
|
|
598
598
|
const oe = {
|
|
599
599
|
pi: Math.PI,
|
|
600
600
|
e: Math.exp(1)
|
|
@@ -655,7 +655,7 @@ const Me = {
|
|
|
655
655
|
"/": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
656
656
|
"+": { precedence: 2, associative: "left", type: f.OPERATION },
|
|
657
657
|
"-": { precedence: 2, associative: "left", type: f.OPERATION }
|
|
658
|
-
},
|
|
658
|
+
}, Se = {
|
|
659
659
|
"^": { precedence: 4, associative: "right", type: f.OPERATION },
|
|
660
660
|
"*": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
661
661
|
"/": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
@@ -668,7 +668,7 @@ const Me = {
|
|
|
668
668
|
sqrt: { precedence: 4, associative: "right", type: f.FUNCTION },
|
|
669
669
|
nthrt: { precedence: 4, associative: "right", type: f.FUNCTION },
|
|
670
670
|
",": { precedence: 2, associative: "left", type: f.FUNCTION_ARGUMENT }
|
|
671
|
-
},
|
|
671
|
+
}, Ie = {
|
|
672
672
|
"^": { precedence: 4, associative: "right", type: f.OPERATION },
|
|
673
673
|
"*": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
674
674
|
"/": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
@@ -691,7 +691,7 @@ const Me = {
|
|
|
691
691
|
var L, F, C, Y, R;
|
|
692
692
|
class _ {
|
|
693
693
|
constructor(e) {
|
|
694
|
-
j(this, L), j(this, F, []), j(this, C, {}), j(this, Y, []), j(this, R),
|
|
694
|
+
j(this, L), j(this, F, []), j(this, C, {}), j(this, Y, []), j(this, R), I(this, L, typeof e > "u" ? D.POLYNOM : e), this.tokenConfigInitialization();
|
|
695
695
|
}
|
|
696
696
|
// Getter
|
|
697
697
|
get rpn() {
|
|
@@ -701,7 +701,7 @@ class _ {
|
|
|
701
701
|
return O(this, F).map((e) => e.token);
|
|
702
702
|
}
|
|
703
703
|
tokenConfigInitialization() {
|
|
704
|
-
return O(this, L) === D.SET ? (
|
|
704
|
+
return O(this, L) === D.SET ? (I(this, C, ze), I(this, R, !1)) : O(this, L) === D.NUMERIC ? (I(this, C, Ie), I(this, R, !0)) : O(this, L) === D.EXPRESSION ? (I(this, C, Se), I(this, R, !0)) : (I(this, C, Me), I(this, R, !0)), I(this, Y, Object.keys(O(this, C)).sort((e, t) => t.length - e.length)), O(this, C);
|
|
705
705
|
}
|
|
706
706
|
/**
|
|
707
707
|
* Get the next token to analyse.
|
|
@@ -813,7 +813,7 @@ class _ {
|
|
|
813
813
|
throw new Error(`Token type ${r} is not handled`);
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
|
-
return
|
|
816
|
+
return I(this, F, i.concat(s.reverse())), this;
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
L = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
|
|
@@ -1916,7 +1916,7 @@ class u {
|
|
|
1916
1916
|
};
|
|
1917
1917
|
#g(e, ...t) {
|
|
1918
1918
|
if (t.length === 0) {
|
|
1919
|
-
if (
|
|
1919
|
+
if (e !== "" && !isNaN(Number(e))) {
|
|
1920
1920
|
this.empty();
|
|
1921
1921
|
const i = new p(Number(e));
|
|
1922
1922
|
return this.add(i), this;
|
|
@@ -3440,7 +3440,7 @@ class g {
|
|
|
3440
3440
|
};
|
|
3441
3441
|
}
|
|
3442
3442
|
}
|
|
3443
|
-
var
|
|
3443
|
+
var S = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(S || {}), se = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(se || {});
|
|
3444
3444
|
function pe(n = 0.5) {
|
|
3445
3445
|
return Math.random() < n;
|
|
3446
3446
|
}
|
|
@@ -3506,9 +3506,9 @@ class v extends g {
|
|
|
3506
3506
|
}
|
|
3507
3507
|
}
|
|
3508
3508
|
class b {
|
|
3509
|
-
static PARALLEL =
|
|
3509
|
+
static PARALLEL = S.Parallel;
|
|
3510
3510
|
// A line is defined as the canonical form
|
|
3511
|
-
static PERPENDICULAR =
|
|
3511
|
+
static PERPENDICULAR = S.Perpendicular;
|
|
3512
3512
|
#t;
|
|
3513
3513
|
// ax + by + c = 0
|
|
3514
3514
|
#e;
|
|
@@ -3557,12 +3557,12 @@ class b {
|
|
|
3557
3557
|
}
|
|
3558
3558
|
if (e.length === 3) {
|
|
3559
3559
|
if (e[0] instanceof g && e[1] instanceof g) {
|
|
3560
|
-
if (e[2] ===
|
|
3560
|
+
if (e[2] === S.Perpendicular)
|
|
3561
3561
|
return this.fromPointAndNormal(e[0], e[1]);
|
|
3562
|
-
if (e[2] ===
|
|
3562
|
+
if (e[2] === S.Parallel)
|
|
3563
3563
|
return this.fromPointAndDirection(e[0], e[1]);
|
|
3564
3564
|
}
|
|
3565
|
-
return e[0] instanceof g && e[1] instanceof b ? e[2] ===
|
|
3565
|
+
return e[0] instanceof g && e[1] instanceof b ? e[2] === S.Parallel || e[2] === null ? this.fromPointAndLine(e[0], e[1], S.Parallel) : this.fromPointAndLine(e[0], e[1], S.Perpendicular) : this.fromCoefficient(
|
|
3566
3566
|
e[0],
|
|
3567
3567
|
e[1],
|
|
3568
3568
|
e[2]
|
|
@@ -3707,7 +3707,7 @@ class b {
|
|
|
3707
3707
|
t.x.clone().opposite(),
|
|
3708
3708
|
e.x.clone().multiply(t.y).subtract(e.y.clone().multiply(t.x)).opposite()
|
|
3709
3709
|
), this.#t = e.clone(), this.#r = t.clone(), this.#n = this.#r.clone().normal(), this);
|
|
3710
|
-
fromPointAndLine = (e, t, i) => (i === void 0 && (i =
|
|
3710
|
+
fromPointAndLine = (e, t, i) => (i === void 0 && (i = S.Parallel), i === S.Parallel ? this.fromPointAndNormal(e, t.normal) : i === S.Perpendicular ? this.fromPointAndNormal(e, t.director) : this);
|
|
3711
3711
|
fromPointAndNormal = (e, t) => this.fromCoefficient(
|
|
3712
3712
|
t.x,
|
|
3713
3713
|
t.y,
|
|
@@ -3891,7 +3891,7 @@ class W {
|
|
|
3891
3891
|
}
|
|
3892
3892
|
#s = (e) => {
|
|
3893
3893
|
const t = new g(this.center, e);
|
|
3894
|
-
return [new b(e, t,
|
|
3894
|
+
return [new b(e, t, S.Perpendicular)];
|
|
3895
3895
|
};
|
|
3896
3896
|
#r = (e) => {
|
|
3897
3897
|
const t = this.center.x.clone().subtract(e.x), i = this.center.y.clone().subtract(e.y), s = new u("x"), r = new u("x^2+1");
|