pimath 0.0.115 → 0.0.116
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/pi.js +37 -6
- package/dist/pi.js.map +1 -1
- package/dist/pi.min.js +1 -1
- package/dist/pi.min.js.map +1 -1
- package/esm/maths/algebra/polynom.js +2 -2
- package/esm/maths/algebra/polynom.js.map +1 -1
- package/esm/maths/geometry/line.d.ts +8 -0
- package/esm/maths/geometry/line.js +34 -3
- package/esm/maths/geometry/line.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/algebra/polynom.ts +2 -2
- package/src/maths/geometry/line.ts +49 -6
- package/tests/geometry/line.test.ts +15 -0
package/dist/pi.js
CHANGED
|
@@ -2749,13 +2749,13 @@ class Polynom {
|
|
|
2749
2749
|
// Values are different
|
|
2750
2750
|
if (da !== db)
|
|
2751
2751
|
return db - da;
|
|
2752
|
-
// if values are equals, check other letters
|
|
2752
|
+
// if values are equals, check other letters - it must be revert in that case !
|
|
2753
2753
|
if (otherLetters.length > 0) {
|
|
2754
2754
|
for (let L of otherLetters) {
|
|
2755
2755
|
let da = a.degree(L).value, db = b.degree(L).value;
|
|
2756
2756
|
// Values are different
|
|
2757
2757
|
if (da !== db)
|
|
2758
|
-
return
|
|
2758
|
+
return da - db;
|
|
2759
2759
|
}
|
|
2760
2760
|
}
|
|
2761
2761
|
return 0;
|
|
@@ -5758,6 +5758,7 @@ const fraction_1 = __webpack_require__(506);
|
|
|
5758
5758
|
const equation_1 = __webpack_require__(760);
|
|
5759
5759
|
const polynom_1 = __webpack_require__(38);
|
|
5760
5760
|
const random_1 = __webpack_require__(330);
|
|
5761
|
+
const monom_1 = __webpack_require__(937);
|
|
5761
5762
|
var LinePropriety;
|
|
5762
5763
|
(function (LinePropriety) {
|
|
5763
5764
|
LinePropriety[LinePropriety["None"] = 0] = "None";
|
|
@@ -6026,6 +6027,7 @@ class Line {
|
|
|
6026
6027
|
return;
|
|
6027
6028
|
};
|
|
6028
6029
|
this._exists = false;
|
|
6030
|
+
this._reduceBeforeDisplay = true;
|
|
6029
6031
|
if (values.length > 0) {
|
|
6030
6032
|
this.parse(...values);
|
|
6031
6033
|
}
|
|
@@ -6071,7 +6073,19 @@ class Line {
|
|
|
6071
6073
|
}
|
|
6072
6074
|
// ------------------------------------------
|
|
6073
6075
|
get equation() {
|
|
6074
|
-
|
|
6076
|
+
let equ = new equation_1.Equation(new polynom_1.Polynom().parse('xy', this._a, this._b, this._c), new polynom_1.Polynom('0'));
|
|
6077
|
+
if (this._reduceBeforeDisplay) {
|
|
6078
|
+
return equ.simplify();
|
|
6079
|
+
}
|
|
6080
|
+
else {
|
|
6081
|
+
return equ;
|
|
6082
|
+
}
|
|
6083
|
+
}
|
|
6084
|
+
get system() {
|
|
6085
|
+
let e1 = new equation_1.Equation(new polynom_1.Polynom('x'), new polynom_1.Polynom(this._OA.x)
|
|
6086
|
+
.add(new monom_1.Monom('k').multiplyByNumber(this._d.x))), e2 = new equation_1.Equation(new polynom_1.Polynom('y'), new polynom_1.Polynom(this._OA.y)
|
|
6087
|
+
.add(new monom_1.Monom('k').multiplyByNumber(this._d.y)));
|
|
6088
|
+
return { x: e1, y: e2 };
|
|
6075
6089
|
}
|
|
6076
6090
|
get tex() {
|
|
6077
6091
|
// canonical => ax + by + c = 0
|
|
@@ -6083,13 +6097,30 @@ class Line {
|
|
|
6083
6097
|
if (this._a.isNegative()) {
|
|
6084
6098
|
canonical.multiply(-1);
|
|
6085
6099
|
}
|
|
6086
|
-
|
|
6100
|
+
let d = this._d.clone();
|
|
6101
|
+
if (this._reduceBeforeDisplay) {
|
|
6102
|
+
d.simplifyDirection();
|
|
6103
|
+
}
|
|
6087
6104
|
return {
|
|
6088
6105
|
canonical: canonical.tex,
|
|
6089
6106
|
equation: canonical.clone().reorder().tex,
|
|
6090
6107
|
mxh: this.slope.isInfinity() ? 'x=' + this.OA.x.tex : 'y=' + new polynom_1.Polynom().parse('x', this.slope, this.height).tex,
|
|
6091
|
-
parametric: `${point_1.Point.pmatrix('x', 'y')} = ${point_1.Point.pmatrix(this._OA.x, this._OA.y)} + k\\cdot ${point_1.Point.pmatrix(d.x, d.y)}
|
|
6092
|
-
|
|
6108
|
+
parametric: `${point_1.Point.pmatrix('x', 'y')} = ${point_1.Point.pmatrix(this._OA.x, this._OA.y)} + k\\cdot ${point_1.Point.pmatrix(d.x, d.y)}`,
|
|
6109
|
+
system: `\\left\\{\\begin{aligned}
|
|
6110
|
+
x &= ${(new polynom_1.Polynom(this._OA.x)
|
|
6111
|
+
.add(new monom_1.Monom(this._d.x).multiply(new monom_1.Monom('k'))))
|
|
6112
|
+
.tex}\\
|
|
6113
|
+
y &= ${(new polynom_1.Polynom(this._OA.y)
|
|
6114
|
+
.add(new monom_1.Monom(this._d.y).multiply(new monom_1.Monom('k'))))
|
|
6115
|
+
.tex}
|
|
6116
|
+
\\end{aligned}\\right.`
|
|
6117
|
+
};
|
|
6118
|
+
}
|
|
6119
|
+
get reduceBeforeDisplay() {
|
|
6120
|
+
return this._reduceBeforeDisplay;
|
|
6121
|
+
}
|
|
6122
|
+
set reduceBeforeDisplay(value) {
|
|
6123
|
+
this._reduceBeforeDisplay = value;
|
|
6093
6124
|
}
|
|
6094
6125
|
get display() {
|
|
6095
6126
|
// canonical => ax + by + c = 0
|