pimath 0.0.112 → 0.0.114
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 +145 -40
- package/dist/pi.js.map +1 -1
- package/dist/pi.min.js +1 -1
- package/dist/pi.min.js.map +1 -1
- package/docs/assets/highlight.css +3 -3
- package/docs/assets/main.js +58 -52
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +488 -621
- package/docs/classes/Logicalset.Logicalset.html +212 -0
- package/docs/classes/Polynom.Rational.html +388 -4
- package/docs/classes/Vector-1.Vector.html +448 -0
- package/docs/classes/Vector.Point.html +342 -1
- package/docs/classes/algebra_equation.Equation.html +749 -22
- package/docs/classes/algebra_linearSystem.LinearSystem.html +397 -1
- package/docs/classes/algebra_monom.Monom.html +906 -110
- package/docs/classes/algebra_polynom.Polynom.html +1258 -28
- package/docs/classes/coefficients_fraction.Fraction.html +929 -17
- package/docs/classes/expressions_numexp.NumExp.html +236 -1
- package/docs/classes/expressions_polynomexp.PolynomExpFactor.html +317 -1
- package/docs/classes/expressions_polynomexp.PolynomExpProduct.html +285 -1
- package/docs/classes/geometry_circle.Circle.html +476 -3
- package/docs/classes/geometry_line.Line.html +719 -3
- package/docs/classes/geometry_triangle.Triangle.html +417 -14
- package/docs/classes/numeric.Numeric.html +263 -14
- package/docs/classes/shutingyard.Shutingyard.html +246 -16
- package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +88 -1
- package/docs/enums/geometry_line.LinePropriety.html +102 -1
- package/docs/enums/shutingyard.ShutingyardMode.html +102 -1
- package/docs/enums/shutingyard.ShutingyardType.html +116 -1
- package/docs/index.html +56 -2
- package/docs/interfaces/algebra_equation.ISolution.html +109 -3
- package/docs/interfaces/algebra_polynom.IEuclidian.html +92 -1
- package/docs/interfaces/geometry_triangle.remarquableLines.html +150 -1
- package/docs/modules/Logicalset.html +74 -3
- package/docs/modules/Polynom.html +74 -3
- package/docs/modules/Vector-1.html +74 -0
- package/docs/modules/Vector.html +74 -3
- package/docs/modules/algebra_equation.html +81 -1
- package/docs/modules/algebra_linearSystem.html +71 -1
- package/docs/modules/algebra_monom.html +76 -1
- package/docs/modules/algebra_polynom.html +81 -1
- package/docs/modules/coefficients_fraction.html +76 -1
- package/docs/modules/expressions_numexp.html +71 -1
- package/docs/modules/expressions_polynomexp.html +73 -1
- package/docs/modules/geometry_circle.html +71 -1
- package/docs/modules/geometry_line.html +76 -1
- package/docs/modules/geometry_triangle.html +76 -1
- package/docs/modules/numeric.html +71 -1
- package/docs/modules/shutingyard.html +90 -1
- package/docs/modules.html +76 -1
- package/docs/types/algebra_monom.literalType.html +70 -0
- package/docs/types/algebra_polynom.PolynomParsingType.html +66 -0
- package/docs/types/coefficients_fraction.FractionParsingType.html +65 -0
- package/docs/types/shutingyard.Token.html +76 -0
- package/docs/types/shutingyard.tokenType.html +81 -0
- package/docs/variables/shutingyard.tokenConstant.html +74 -0
- package/esm/index.js.map +1 -1
- package/esm/maths/algebra/equation.js +1 -1
- package/esm/maths/algebra/equation.js.map +1 -1
- package/esm/maths/geometry/line.d.ts +19 -16
- package/esm/maths/geometry/line.js +63 -35
- package/esm/maths/geometry/line.js.map +1 -1
- package/esm/maths/geometry/point.d.ts +2 -0
- package/esm/maths/geometry/point.js +3 -0
- package/esm/maths/geometry/point.js.map +1 -1
- package/esm/maths/geometry/vector.d.ts +3 -1
- package/esm/maths/geometry/vector.js +6 -4
- package/esm/maths/geometry/vector.js.map +1 -1
- package/esm/maths/randomization/random.d.ts +4 -2
- package/esm/maths/randomization/random.js +5 -0
- package/esm/maths/randomization/random.js.map +1 -1
- package/esm/maths/randomization/rndGeometryLine.js.map +1 -1
- package/esm/maths/randomization/rndGeometryPoint.d.ts +12 -0
- package/esm/maths/randomization/rndGeometryPoint.js +61 -0
- package/esm/maths/randomization/rndGeometryPoint.js.map +1 -0
- package/esm/maths/randomization/rndTypes.d.ts +6 -0
- package/package.json +8 -8
- package/src/index.ts +1 -0
- package/src/maths/algebra/equation.ts +1 -1
- package/src/maths/geometry/line.ts +111 -71
- package/src/maths/geometry/point.ts +4 -0
- package/src/maths/geometry/vector.ts +8 -5
- package/src/maths/randomization/random.ts +15 -2
- package/src/maths/randomization/rndGeometryLine.ts +5 -6
- package/src/maths/randomization/rndGeometryPoint.ts +69 -0
- package/src/maths/randomization/rndTypes.ts +8 -0
- package/tests/geometry/line.test.ts +18 -8
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/Logicalset.Logicalset-1.html +0 -5
- package/docs/classes/Vector.Vector-1.html +0 -1
- package/docs/classes/coefficients_nthroot.NthRoot.html +0 -3
- package/docs/modules/coefficients_nthroot.html +0 -1
package/dist/pi.js
CHANGED
|
@@ -216,7 +216,7 @@ class Equation {
|
|
|
216
216
|
if (this._sign !== '=' && F.sign() === -1) {
|
|
217
217
|
this._reverseSign();
|
|
218
218
|
}
|
|
219
|
-
return this
|
|
219
|
+
return this;
|
|
220
220
|
};
|
|
221
221
|
/**
|
|
222
222
|
* divide an equation by a given value (transformed as a fraction)
|
|
@@ -5757,6 +5757,7 @@ const numeric_1 = __webpack_require__(956);
|
|
|
5757
5757
|
const fraction_1 = __webpack_require__(506);
|
|
5758
5758
|
const equation_1 = __webpack_require__(760);
|
|
5759
5759
|
const polynom_1 = __webpack_require__(38);
|
|
5760
|
+
const random_1 = __webpack_require__(330);
|
|
5760
5761
|
var LinePropriety;
|
|
5761
5762
|
(function (LinePropriety) {
|
|
5762
5763
|
LinePropriety[LinePropriety["None"] = 0] = "None";
|
|
@@ -5766,6 +5767,24 @@ var LinePropriety;
|
|
|
5766
5767
|
})(LinePropriety = exports.LinePropriety || (exports.LinePropriety = {}));
|
|
5767
5768
|
class Line {
|
|
5768
5769
|
constructor(...values) {
|
|
5770
|
+
this.randomPoint = (k) => {
|
|
5771
|
+
// Return a random point on the line.
|
|
5772
|
+
return this._d
|
|
5773
|
+
.clone()
|
|
5774
|
+
.multiplyByScalar(random_1.Random.numberSym((k === undefined || k <= 1) ? 3 : k, false))
|
|
5775
|
+
.add(this._OA.asVector)
|
|
5776
|
+
.asPoint;
|
|
5777
|
+
};
|
|
5778
|
+
this.randomNearPoint = (k) => {
|
|
5779
|
+
let pt = this.randomPoint(k);
|
|
5780
|
+
let maxIterationTest = 10;
|
|
5781
|
+
while (this.isOnLine(pt) && maxIterationTest > 0) {
|
|
5782
|
+
pt.x.add(random_1.Random.numberSym(1, false));
|
|
5783
|
+
pt.y.add(random_1.Random.numberSym(1, false));
|
|
5784
|
+
maxIterationTest--;
|
|
5785
|
+
}
|
|
5786
|
+
return pt;
|
|
5787
|
+
};
|
|
5769
5788
|
// ------------------------------------------
|
|
5770
5789
|
// Creation / parsing functions
|
|
5771
5790
|
// ------------------------------------------
|
|
@@ -5920,6 +5939,14 @@ class Line {
|
|
|
5920
5939
|
// ------------------------------------------
|
|
5921
5940
|
// Mathematical operations
|
|
5922
5941
|
// ------------------------------------------
|
|
5942
|
+
this.isOnLine = (pt) => {
|
|
5943
|
+
return this._a.clone()
|
|
5944
|
+
.multiply(pt.x)
|
|
5945
|
+
.add(this._b.clone()
|
|
5946
|
+
.multiply(pt.y))
|
|
5947
|
+
.add(this._c)
|
|
5948
|
+
.isZero();
|
|
5949
|
+
};
|
|
5923
5950
|
this.isParellelTo = (line) => {
|
|
5924
5951
|
// Do they have the isSame direction ?
|
|
5925
5952
|
return this.slope.isEqual(line.slope) && this.height.isNotEqual(line.height);
|
|
@@ -6001,11 +6028,44 @@ class Line {
|
|
|
6001
6028
|
}
|
|
6002
6029
|
return this;
|
|
6003
6030
|
}
|
|
6004
|
-
get
|
|
6005
|
-
return this.
|
|
6031
|
+
get a() {
|
|
6032
|
+
return this._a;
|
|
6033
|
+
}
|
|
6034
|
+
set a(value) {
|
|
6035
|
+
this._a = value;
|
|
6036
|
+
}
|
|
6037
|
+
get b() {
|
|
6038
|
+
return this._b;
|
|
6039
|
+
}
|
|
6040
|
+
set b(value) {
|
|
6041
|
+
this._b = value;
|
|
6042
|
+
}
|
|
6043
|
+
get c() {
|
|
6044
|
+
return this._c;
|
|
6006
6045
|
}
|
|
6007
6046
|
// ------------------------------------------
|
|
6008
6047
|
// Getter and setter
|
|
6048
|
+
set c(value) {
|
|
6049
|
+
this._c = value;
|
|
6050
|
+
}
|
|
6051
|
+
get OA() {
|
|
6052
|
+
return this._OA;
|
|
6053
|
+
}
|
|
6054
|
+
set OA(value) {
|
|
6055
|
+
this._OA = value;
|
|
6056
|
+
}
|
|
6057
|
+
get d() {
|
|
6058
|
+
return this._d;
|
|
6059
|
+
}
|
|
6060
|
+
set d(value) {
|
|
6061
|
+
this._d = value;
|
|
6062
|
+
}
|
|
6063
|
+
get n() {
|
|
6064
|
+
return this._n;
|
|
6065
|
+
}
|
|
6066
|
+
get exists() {
|
|
6067
|
+
return this._exists;
|
|
6068
|
+
}
|
|
6009
6069
|
// ------------------------------------------
|
|
6010
6070
|
get equation() {
|
|
6011
6071
|
return new equation_1.Equation(new polynom_1.Polynom().parse('xy', this._a, this._b, this._c), new polynom_1.Polynom('0')).simplify();
|
|
@@ -6043,45 +6103,12 @@ class Line {
|
|
|
6043
6103
|
parametric: ""
|
|
6044
6104
|
};
|
|
6045
6105
|
}
|
|
6046
|
-
get a() {
|
|
6047
|
-
return this._a;
|
|
6048
|
-
}
|
|
6049
|
-
set a(value) {
|
|
6050
|
-
this._a = value;
|
|
6051
|
-
}
|
|
6052
|
-
get b() {
|
|
6053
|
-
return this._b;
|
|
6054
|
-
}
|
|
6055
|
-
set b(value) {
|
|
6056
|
-
this._b = value;
|
|
6057
|
-
}
|
|
6058
|
-
get c() {
|
|
6059
|
-
return this._c;
|
|
6060
|
-
}
|
|
6061
|
-
set c(value) {
|
|
6062
|
-
this._c = value;
|
|
6063
|
-
}
|
|
6064
|
-
get OA() {
|
|
6065
|
-
return this._OA;
|
|
6066
|
-
}
|
|
6067
|
-
set OA(value) {
|
|
6068
|
-
this._OA = value;
|
|
6069
|
-
}
|
|
6070
|
-
get d() {
|
|
6071
|
-
return this._d;
|
|
6072
|
-
}
|
|
6073
|
-
get n() {
|
|
6074
|
-
return this._n;
|
|
6075
|
-
}
|
|
6076
6106
|
get normal() {
|
|
6077
6107
|
return new vector_1.Vector(this._a, this._b);
|
|
6078
6108
|
}
|
|
6079
6109
|
get director() {
|
|
6080
6110
|
return this._d.clone();
|
|
6081
6111
|
}
|
|
6082
|
-
set d(value) {
|
|
6083
|
-
this._d = value;
|
|
6084
|
-
}
|
|
6085
6112
|
get slope() {
|
|
6086
6113
|
return this._a.clone().opposed().divide(this._b);
|
|
6087
6114
|
}
|
|
@@ -6163,6 +6190,7 @@ class Line {
|
|
|
6163
6190
|
}
|
|
6164
6191
|
}
|
|
6165
6192
|
exports.Line = Line;
|
|
6193
|
+
// A line is defined as the canonical form
|
|
6166
6194
|
Line.PERPENDICULAR = LinePropriety.Perpendicular;
|
|
6167
6195
|
Line.PARALLEL = LinePropriety.Parallel;
|
|
6168
6196
|
|
|
@@ -6313,6 +6341,9 @@ class Point {
|
|
|
6313
6341
|
pts.push(this._y.tex);
|
|
6314
6342
|
return `(${pts.join(';')})`;
|
|
6315
6343
|
}
|
|
6344
|
+
get asVector() {
|
|
6345
|
+
return new vector_1.Vector(this.x, this.y);
|
|
6346
|
+
}
|
|
6316
6347
|
get key() {
|
|
6317
6348
|
return `${this.x.display};${this.y.display}`;
|
|
6318
6349
|
}
|
|
@@ -6721,8 +6752,8 @@ class Vector {
|
|
|
6721
6752
|
return this.add(V.clone().opposed());
|
|
6722
6753
|
};
|
|
6723
6754
|
this.scalarProductWithVector = (V) => {
|
|
6724
|
-
|
|
6725
|
-
return this._x.clone().multiply(V.x).add(this._y.clone().multiply(V.y));
|
|
6755
|
+
return Vector.scalarProduct(this, V);
|
|
6756
|
+
// return this._x.clone().multiply(V.x).add(this._y.clone().multiply(V.y));
|
|
6726
6757
|
};
|
|
6727
6758
|
this.normal = () => {
|
|
6728
6759
|
let x = this.x.clone().opposed(), y = this.y.clone();
|
|
@@ -6794,14 +6825,16 @@ class Vector {
|
|
|
6794
6825
|
get tex() {
|
|
6795
6826
|
return `\\begin{pmatrix}${this._x.tex} \\\\\ ${this._y.tex} \\end{pmatrix}`;
|
|
6796
6827
|
}
|
|
6828
|
+
get asPoint() {
|
|
6829
|
+
return new point_1.Point(this.x, this.y);
|
|
6830
|
+
}
|
|
6797
6831
|
get isNull() {
|
|
6798
6832
|
return this.x.isZero() && this.y.isZero();
|
|
6799
6833
|
}
|
|
6800
6834
|
}
|
|
6801
6835
|
exports.Vector = Vector;
|
|
6802
6836
|
Vector.scalarProduct = (v1, v2) => {
|
|
6803
|
-
|
|
6804
|
-
return v1.x.value * v2.x.value + v1.y.value * v2.y.value;
|
|
6837
|
+
return v1.x.clone().multiply(v2.x).add(v1.y.clone().multiply(v2.y));
|
|
6805
6838
|
};
|
|
6806
6839
|
|
|
6807
6840
|
|
|
@@ -7008,6 +7041,7 @@ const rndMonom_1 = __webpack_require__(793);
|
|
|
7008
7041
|
const rndHelpers_1 = __webpack_require__(140);
|
|
7009
7042
|
const rndFraction_1 = __webpack_require__(754);
|
|
7010
7043
|
const rndGeometryLine_1 = __webpack_require__(821);
|
|
7044
|
+
const rndGeometryPoint_1 = __webpack_require__(246);
|
|
7011
7045
|
__exportStar(__webpack_require__(230), exports);
|
|
7012
7046
|
var Random;
|
|
7013
7047
|
(function (Random) {
|
|
@@ -7057,6 +7091,10 @@ var Random;
|
|
|
7057
7091
|
return (new rndGeometryLine_1.rndGeometryLine(config).generate());
|
|
7058
7092
|
}
|
|
7059
7093
|
Geometry.line = line;
|
|
7094
|
+
function point(config) {
|
|
7095
|
+
return (new rndGeometryPoint_1.rndGeometryPoint(config).generate());
|
|
7096
|
+
}
|
|
7097
|
+
Geometry.point = point;
|
|
7060
7098
|
})(Geometry = Random.Geometry || (Random.Geometry = {}));
|
|
7061
7099
|
})(Random = exports.Random || (exports.Random = {}));
|
|
7062
7100
|
|
|
@@ -7191,6 +7229,73 @@ class rndGeometryLine extends randomCore_1.randomCore {
|
|
|
7191
7229
|
exports.rndGeometryLine = rndGeometryLine;
|
|
7192
7230
|
|
|
7193
7231
|
|
|
7232
|
+
/***/ }),
|
|
7233
|
+
|
|
7234
|
+
/***/ 246:
|
|
7235
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7236
|
+
|
|
7237
|
+
|
|
7238
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7239
|
+
exports.rndGeometryPoint = void 0;
|
|
7240
|
+
const randomCore_1 = __webpack_require__(373);
|
|
7241
|
+
const random_1 = __webpack_require__(330);
|
|
7242
|
+
const point_1 = __webpack_require__(557);
|
|
7243
|
+
const fraction_1 = __webpack_require__(506);
|
|
7244
|
+
/**
|
|
7245
|
+
* Create a random monom based on a based configuration
|
|
7246
|
+
*/
|
|
7247
|
+
class rndGeometryPoint extends randomCore_1.randomCore {
|
|
7248
|
+
constructor(userConfig) {
|
|
7249
|
+
super();
|
|
7250
|
+
this.generate = () => {
|
|
7251
|
+
let x, y, zeroX = this._config.axis === true || this._config.axis === 'x', zeroY = this._config.axis === true || this._config.axis === 'y';
|
|
7252
|
+
x = this._config.fraction ?
|
|
7253
|
+
random_1.Random.fraction({ max: this._config.max, zero: zeroX }) :
|
|
7254
|
+
new fraction_1.Fraction(random_1.Random.numberSym(this._config.max, zeroX));
|
|
7255
|
+
y = this._config.fraction ?
|
|
7256
|
+
random_1.Random.fraction({ max: this._config.max, zero: zeroY }) :
|
|
7257
|
+
new fraction_1.Fraction(random_1.Random.numberSym(this._config.max, zeroY));
|
|
7258
|
+
if (+this._config.quadrant === 1) {
|
|
7259
|
+
x.abs();
|
|
7260
|
+
y.abs();
|
|
7261
|
+
}
|
|
7262
|
+
if (+this._config.quadrant === 2) {
|
|
7263
|
+
if (x.isPositive()) {
|
|
7264
|
+
x.opposed();
|
|
7265
|
+
}
|
|
7266
|
+
if (y.isNegative()) {
|
|
7267
|
+
y.opposed();
|
|
7268
|
+
}
|
|
7269
|
+
}
|
|
7270
|
+
if (+this._config.quadrant === 3) {
|
|
7271
|
+
if (x.isPositive()) {
|
|
7272
|
+
x.opposed();
|
|
7273
|
+
}
|
|
7274
|
+
if (y.isPositive()) {
|
|
7275
|
+
y.opposed();
|
|
7276
|
+
}
|
|
7277
|
+
}
|
|
7278
|
+
if (+this._config.quadrant === 4) {
|
|
7279
|
+
if (x.isNegative()) {
|
|
7280
|
+
x.opposed();
|
|
7281
|
+
}
|
|
7282
|
+
if (y.isPositive()) {
|
|
7283
|
+
y.opposed();
|
|
7284
|
+
}
|
|
7285
|
+
}
|
|
7286
|
+
return new point_1.Point(x, y);
|
|
7287
|
+
};
|
|
7288
|
+
this._defaultConfig = {
|
|
7289
|
+
axis: true,
|
|
7290
|
+
fraction: false,
|
|
7291
|
+
max: 10
|
|
7292
|
+
};
|
|
7293
|
+
this._config = this.mergeConfig(userConfig, this._defaultConfig);
|
|
7294
|
+
}
|
|
7295
|
+
}
|
|
7296
|
+
exports.rndGeometryPoint = rndGeometryPoint;
|
|
7297
|
+
|
|
7298
|
+
|
|
7194
7299
|
/***/ }),
|
|
7195
7300
|
|
|
7196
7301
|
/***/ 140:
|