pimath 0.0.120 → 0.0.122
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/.idea/PI.iml +7 -1
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]/shelved.patch +90 -0
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]1/shelved.patch +107 -0
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31__Default_Changelist_.xml +4 -0
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31__Default_Changelist_1.xml +4 -0
- package/LICENSE.md +1 -1
- package/dev/pimath.js +7929 -0
- package/dev/pimath.js.map +1 -0
- package/dist/{pi.js → pimath.js} +7613 -7840
- package/dist/pimath.js.map +1 -0
- package/dist/pimath.min.js +2 -0
- package/dist/pimath.min.js.map +1 -0
- package/docs/assets/main.js +58 -58
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +1367 -1280
- package/docs/classes/Logicalset.Logicalset.html +221 -212
- package/docs/classes/Polynom.Rational.html +391 -388
- package/docs/classes/Vector-1.Vector.html +494 -448
- package/docs/classes/Vector.Point.html +341 -342
- package/docs/classes/algebra_equation.Equation.html +796 -753
- package/docs/classes/algebra_linearSystem.LinearSystem.html +408 -397
- package/docs/classes/algebra_monom.Monom.html +967 -910
- package/docs/classes/algebra_polynom.Polynom.html +1281 -1260
- package/docs/classes/coefficients_fraction.Fraction.html +939 -931
- package/docs/classes/geometry_circle.Circle.html +476 -476
- package/docs/classes/geometry_line.Line.html +779 -719
- package/docs/classes/geometry_triangle.Triangle.html +429 -420
- package/docs/classes/numeric.Numeric.html +269 -263
- package/docs/classes/shutingyard.Shutingyard.html +259 -248
- package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +89 -88
- package/docs/enums/geometry_line.LinePropriety.html +102 -102
- package/docs/enums/shutingyard.ShutingyardMode.html +106 -102
- package/docs/enums/shutingyard.ShutingyardType.html +120 -116
- package/docs/index.html +63 -65
- package/docs/interfaces/algebra_equation.ISolution.html +111 -109
- package/docs/interfaces/algebra_polynom.IEuclidian.html +93 -92
- package/docs/interfaces/geometry_triangle.remarquableLines.html +150 -150
- package/docs/modules/Logicalset.html +69 -74
- package/docs/modules/Polynom.html +69 -74
- package/docs/modules/Vector-1.html +69 -74
- package/docs/modules/Vector.html +69 -74
- package/docs/modules/algebra_equation.html +75 -81
- package/docs/modules/algebra_linearSystem.html +65 -71
- package/docs/modules/algebra_monom.html +70 -76
- package/docs/modules/algebra_polynom.html +75 -81
- package/docs/modules/coefficients_fraction.html +70 -76
- package/docs/modules/geometry_circle.html +65 -71
- package/docs/modules/geometry_line.html +70 -76
- package/docs/modules/geometry_triangle.html +70 -76
- package/docs/modules/numeric.html +65 -71
- package/docs/modules/shutingyard.html +84 -90
- package/docs/types/algebra_monom.literalType.html +66 -70
- package/docs/types/algebra_polynom.PolynomParsingType.html +62 -66
- package/docs/types/coefficients_fraction.FractionParsingType.html +61 -65
- package/docs/types/shutingyard.Token.html +72 -76
- package/docs/types/shutingyard.tokenType.html +77 -81
- package/docs/variables/shutingyard.tokenConstant.html +70 -74
- package/esm/index.d.ts +38 -41
- package/esm/index.js +43 -46
- package/esm/index.js.map +1 -1
- package/esm/maths/algebra/equation.d.ts +119 -117
- package/esm/maths/algebra/equation.js +796 -785
- package/esm/maths/algebra/equation.js.map +1 -1
- package/esm/maths/algebra/linearSystem.d.ts +39 -38
- package/esm/maths/algebra/linearSystem.js +278 -262
- package/esm/maths/algebra/linearSystem.js.map +1 -1
- package/esm/maths/algebra/logicalset.d.ts +28 -28
- package/esm/maths/algebra/logicalset.js +157 -157
- package/esm/maths/algebra/monom.d.ts +206 -206
- package/esm/maths/algebra/monom.js +908 -908
- package/esm/maths/algebra/monom.js.map +1 -1
- package/esm/maths/algebra/polynom.d.ts +157 -157
- package/esm/maths/algebra/polynom.js +1277 -1277
- package/esm/maths/algebra/rational.d.ts +45 -45
- package/esm/maths/algebra/rational.js +183 -183
- package/esm/maths/algebra/study/rationalStudy.d.ts +28 -28
- package/esm/maths/algebra/study/rationalStudy.js +243 -243
- package/esm/maths/algebra/study.d.ts +143 -142
- package/esm/maths/algebra/study.js +378 -377
- package/esm/maths/algebra/study.js.map +1 -1
- package/esm/maths/coefficients/fraction.d.ts +90 -90
- package/esm/maths/coefficients/fraction.js +516 -516
- package/esm/maths/coefficients/fraction.js.map +1 -1
- package/esm/maths/coefficients/nthRoot.d.ts +23 -23
- package/esm/maths/coefficients/nthRoot.js +136 -136
- package/esm/maths/geometry/circle.d.ts +45 -45
- package/esm/maths/geometry/circle.js +323 -323
- package/esm/maths/geometry/line.d.ts +99 -99
- package/esm/maths/geometry/line.js +481 -481
- package/esm/maths/geometry/line.js.map +1 -1
- package/esm/maths/geometry/point.d.ts +34 -34
- package/esm/maths/geometry/point.js +166 -166
- package/esm/maths/geometry/point.js.map +1 -1
- package/esm/maths/geometry/triangle.d.ts +85 -85
- package/esm/maths/geometry/triangle.js +268 -268
- package/esm/maths/geometry/vector.d.ts +41 -41
- package/esm/maths/geometry/vector.js +197 -197
- package/esm/maths/geometry/vector.js.map +1 -1
- package/esm/maths/numeric.d.ts +28 -28
- package/esm/maths/numeric.js +180 -180
- package/esm/maths/numexp.d.ts +19 -0
- package/esm/maths/numexp.js +186 -0
- package/esm/maths/numexp.js.map +1 -0
- package/esm/maths/randomization/random.d.ts +23 -23
- package/esm/maths/randomization/random.js +78 -78
- package/esm/maths/randomization/random.js.map +1 -1
- package/esm/maths/randomization/randomCore.d.ts +7 -7
- package/esm/maths/randomization/randomCore.js +21 -21
- package/esm/maths/randomization/rndFraction.d.ts +12 -12
- package/esm/maths/randomization/rndFraction.js +43 -43
- package/esm/maths/randomization/rndGeometryLine.d.ts +12 -12
- package/esm/maths/randomization/rndGeometryLine.js +45 -45
- package/esm/maths/randomization/rndGeometryPoint.d.ts +12 -12
- package/esm/maths/randomization/rndGeometryPoint.js +60 -60
- package/esm/maths/randomization/rndHelpers.d.ts +23 -23
- package/esm/maths/randomization/rndHelpers.js +76 -76
- package/esm/maths/randomization/rndMonom.d.ts +12 -12
- package/esm/maths/randomization/rndMonom.js +52 -52
- package/esm/maths/randomization/rndPolynom.d.ts +13 -13
- package/esm/maths/randomization/rndPolynom.js +74 -74
- package/esm/maths/randomization/rndTypes.d.ts +34 -34
- package/esm/maths/randomization/rndTypes.js +2 -2
- package/esm/maths/shutingyard.d.ts +59 -59
- package/esm/maths/shutingyard.js +442 -442
- package/esm/maths/shutingyard.js.map +1 -1
- package/package.json +11 -11
- package/public/index.html +50 -81
- package/public/playground.html +7 -8
- package/src/index.ts +1 -4
- package/src/maths/algebra/equation.ts +16 -0
- package/src/maths/algebra/linearSystem.ts +20 -0
- package/src/maths/algebra/study.ts +12 -10
- package/src/maths/{expressions/numexp.ts → numexp.ts} +2 -2
- package/tests/algebra/equation.test.ts +19 -5
- package/tests/algebra/linear.test.ts +3 -11
- package/tests/algebra/polynom.test.ts +7 -8
- package/tests/algebra/rationnal.test.ts +1 -1
- package/tests/algebra/study.test.ts +2 -9
- package/tests/coefficients/fraction.test.ts +8 -8
- package/tests/custom.test.ts +33 -37
- package/tests/numeric.test.ts +1 -2
- package/tests/numexp.test.ts +13 -5
- package/tests/shutingyard.test.ts +3 -3
- package/webpack-production-min.config.js +1 -1
- package/webpack-production.config.js +1 -1
- package/webpack.config.js +1 -1
- package/dist/pi.js.map +0 -1
- package/dist/pi.min.js +0 -2
- package/dist/pi.min.js.map +0 -1
- package/docs/classes/expressions_numexp.NumExp.html +0 -236
- package/docs/classes/expressions_polynomexp.PolynomExpFactor.html +0 -317
- package/docs/classes/expressions_polynomexp.PolynomExpProduct.html +0 -285
- package/docs/modules/expressions_numexp.html +0 -71
- package/docs/modules/expressions_polynomexp.html +0 -73
- package/docs/modules.html +0 -76
- package/graph.svg +0 -1033
- package/src/maths/expressions/ExpressionTree.ts +0 -172
- package/src/maths/expressions/expression.ts +0 -286
- package/src/maths/expressions/expressionFactor.ts +0 -190
- package/src/maths/expressions/expressionMember.ts +0 -233
- package/src/maths/expressions/expressionOperators.ts +0 -49
- package/src/maths/expressions/expressionParser.ts +0 -295
- package/src/maths/expressions/factors/ExpFactor.ts +0 -39
- package/src/maths/expressions/factors/ExpFactorConstant.ts +0 -60
- package/src/maths/expressions/factors/ExpFactorExponential.ts +0 -26
- package/src/maths/expressions/factors/ExpFactorNumber.ts +0 -72
- package/src/maths/expressions/factors/ExpFactorPower.ts +0 -42
- package/src/maths/expressions/factors/ExpFactorTrigo.ts +0 -53
- package/src/maths/expressions/factors/ExpFactorVariable.ts +0 -45
- package/src/maths/expressions/internals.ts +0 -14
- package/src/maths/expressions/polynomexp.bkp.ts +0 -221
- package/src/maths/expressions/polynomexp.ts +0 -310
- package/tests/expressions/expressions.test.ts +0 -145
- package/tests/expressions/expressiontree.test.ts +0 -11
- package/tests/polynomexp.test.ts +0 -12
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Random = void 0;
|
|
18
|
-
const rndPolynom_1 = require("./rndPolynom");
|
|
19
|
-
const rndMonom_1 = require("./rndMonom");
|
|
20
|
-
const rndHelpers_1 = require("./rndHelpers");
|
|
21
|
-
const rndFraction_1 = require("./rndFraction");
|
|
22
|
-
const rndGeometryLine_1 = require("./rndGeometryLine");
|
|
23
|
-
const rndGeometryPoint_1 = require("./rndGeometryPoint");
|
|
24
|
-
__exportStar(require("./rndTypes"), exports);
|
|
25
|
-
var Random;
|
|
26
|
-
(function (Random) {
|
|
27
|
-
function polynom(config) {
|
|
28
|
-
return (new rndPolynom_1.rndPolynom(config)).generate();
|
|
29
|
-
}
|
|
30
|
-
Random.polynom = polynom;
|
|
31
|
-
function monom(config) {
|
|
32
|
-
return (new rndMonom_1.rndMonom(config)).generate();
|
|
33
|
-
}
|
|
34
|
-
Random.monom = monom;
|
|
35
|
-
function fraction(config) {
|
|
36
|
-
return (new rndFraction_1.rndFraction(config)).generate();
|
|
37
|
-
}
|
|
38
|
-
Random.fraction = fraction;
|
|
39
|
-
function number(from, to) {
|
|
40
|
-
return rndHelpers_1.rndHelpers.randomInt(from, to);
|
|
41
|
-
}
|
|
42
|
-
Random.number = number;
|
|
43
|
-
function numberSym(max, allowZero) {
|
|
44
|
-
return rndHelpers_1.rndHelpers.randomIntSym(max, allowZero);
|
|
45
|
-
}
|
|
46
|
-
Random.numberSym = numberSym;
|
|
47
|
-
function prime(max) {
|
|
48
|
-
return rndHelpers_1.rndHelpers.randomPrime(max);
|
|
49
|
-
}
|
|
50
|
-
Random.prime = prime;
|
|
51
|
-
function bool(percent) {
|
|
52
|
-
return rndHelpers_1.rndHelpers.randomBool(percent);
|
|
53
|
-
}
|
|
54
|
-
Random.bool = bool;
|
|
55
|
-
function array(arr, number) {
|
|
56
|
-
return rndHelpers_1.rndHelpers.randomArray(arr, number);
|
|
57
|
-
}
|
|
58
|
-
Random.array = array;
|
|
59
|
-
function item(arr) {
|
|
60
|
-
return rndHelpers_1.rndHelpers.randomItem(arr);
|
|
61
|
-
}
|
|
62
|
-
Random.item = item;
|
|
63
|
-
function shuffle(arr) {
|
|
64
|
-
return rndHelpers_1.rndHelpers.shuffleArray(arr);
|
|
65
|
-
}
|
|
66
|
-
Random.shuffle = shuffle;
|
|
67
|
-
let Geometry;
|
|
68
|
-
(function (Geometry) {
|
|
69
|
-
function line(config) {
|
|
70
|
-
return (new rndGeometryLine_1.rndGeometryLine(config).generate());
|
|
71
|
-
}
|
|
72
|
-
Geometry.line = line;
|
|
73
|
-
function point(config) {
|
|
74
|
-
return (new rndGeometryPoint_1.rndGeometryPoint(config).generate());
|
|
75
|
-
}
|
|
76
|
-
Geometry.point = point;
|
|
77
|
-
})(Geometry = Random.Geometry || (Random.Geometry = {}));
|
|
78
|
-
})(Random
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Random = void 0;
|
|
18
|
+
const rndPolynom_1 = require("./rndPolynom");
|
|
19
|
+
const rndMonom_1 = require("./rndMonom");
|
|
20
|
+
const rndHelpers_1 = require("./rndHelpers");
|
|
21
|
+
const rndFraction_1 = require("./rndFraction");
|
|
22
|
+
const rndGeometryLine_1 = require("./rndGeometryLine");
|
|
23
|
+
const rndGeometryPoint_1 = require("./rndGeometryPoint");
|
|
24
|
+
__exportStar(require("./rndTypes"), exports);
|
|
25
|
+
var Random;
|
|
26
|
+
(function (Random) {
|
|
27
|
+
function polynom(config) {
|
|
28
|
+
return (new rndPolynom_1.rndPolynom(config)).generate();
|
|
29
|
+
}
|
|
30
|
+
Random.polynom = polynom;
|
|
31
|
+
function monom(config) {
|
|
32
|
+
return (new rndMonom_1.rndMonom(config)).generate();
|
|
33
|
+
}
|
|
34
|
+
Random.monom = monom;
|
|
35
|
+
function fraction(config) {
|
|
36
|
+
return (new rndFraction_1.rndFraction(config)).generate();
|
|
37
|
+
}
|
|
38
|
+
Random.fraction = fraction;
|
|
39
|
+
function number(from, to) {
|
|
40
|
+
return rndHelpers_1.rndHelpers.randomInt(from, to);
|
|
41
|
+
}
|
|
42
|
+
Random.number = number;
|
|
43
|
+
function numberSym(max, allowZero) {
|
|
44
|
+
return rndHelpers_1.rndHelpers.randomIntSym(max, allowZero);
|
|
45
|
+
}
|
|
46
|
+
Random.numberSym = numberSym;
|
|
47
|
+
function prime(max) {
|
|
48
|
+
return rndHelpers_1.rndHelpers.randomPrime(max);
|
|
49
|
+
}
|
|
50
|
+
Random.prime = prime;
|
|
51
|
+
function bool(percent) {
|
|
52
|
+
return rndHelpers_1.rndHelpers.randomBool(percent);
|
|
53
|
+
}
|
|
54
|
+
Random.bool = bool;
|
|
55
|
+
function array(arr, number) {
|
|
56
|
+
return rndHelpers_1.rndHelpers.randomArray(arr, number);
|
|
57
|
+
}
|
|
58
|
+
Random.array = array;
|
|
59
|
+
function item(arr) {
|
|
60
|
+
return rndHelpers_1.rndHelpers.randomItem(arr);
|
|
61
|
+
}
|
|
62
|
+
Random.item = item;
|
|
63
|
+
function shuffle(arr) {
|
|
64
|
+
return rndHelpers_1.rndHelpers.shuffleArray(arr);
|
|
65
|
+
}
|
|
66
|
+
Random.shuffle = shuffle;
|
|
67
|
+
let Geometry;
|
|
68
|
+
(function (Geometry) {
|
|
69
|
+
function line(config) {
|
|
70
|
+
return (new rndGeometryLine_1.rndGeometryLine(config).generate());
|
|
71
|
+
}
|
|
72
|
+
Geometry.line = line;
|
|
73
|
+
function point(config) {
|
|
74
|
+
return (new rndGeometryPoint_1.rndGeometryPoint(config).generate());
|
|
75
|
+
}
|
|
76
|
+
Geometry.point = point;
|
|
77
|
+
})(Geometry = Random.Geometry || (Random.Geometry = {}));
|
|
78
|
+
})(Random || (exports.Random = Random = {}));
|
|
79
79
|
//# sourceMappingURL=random.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../../src/maths/randomization/random.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,yCAAoC;AACpC,6CAAwC;AAQxC,+CAA0C;AAK1C,uDAAkD;AAElD,yDAAoD;AAEpD,6CAA0B;AAE1B,IAAiB,MAAM,CAmDtB;AAnDD,WAAiB,MAAM;IACnB,SAAgB,OAAO,CAAC,MAA4B;QAChD,OAAO,CAAC,IAAI,uBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC9C,CAAC;IAFe,cAAO,UAEtB,CAAA;IAED,SAAgB,KAAK,CAAC,MAA0B;QAC5C,OAAO,CAAC,IAAI,mBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC5C,CAAC;IAFe,YAAK,QAEpB,CAAA;IAED,SAAgB,QAAQ,CAAC,MAAgC;QACrD,OAAO,CAAC,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC/C,CAAC;IAFe,eAAQ,WAEvB,CAAA;IAED,SAAgB,MAAM,CAAC,IAAY,EAAE,EAAU;QAC3C,OAAO,uBAAU,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACzC,CAAC;IAFe,aAAM,SAErB,CAAA;IAED,SAAgB,SAAS,CAAC,GAAW,EAAE,SAAmB;QACtD,OAAO,uBAAU,CAAC,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;IAClD,CAAC;IAFe,gBAAS,YAExB,CAAA;IAED,SAAgB,KAAK,CAAC,GAAW;QAC7B,OAAO,uBAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IACtC,CAAC;IAFe,YAAK,QAEpB,CAAA;IAED,SAAgB,IAAI,CAAC,OAAgB;QACjC,OAAO,uBAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;IAFe,WAAI,OAEnB,CAAA;IAED,SAAgB,KAAK,CAAC,GAAU,EAAE,MAAe;QAC7C,OAAO,uBAAU,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC9C,CAAC;IAFe,YAAK,QAEpB,CAAA;IAED,SAAgB,IAAI,CAAC,GAAU;QAC3B,OAAO,uBAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;IAFe,WAAI,OAEnB,CAAA;IAED,SAAgB,OAAO,CAAC,GAAU;QAC9B,OAAO,uBAAU,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACvC,CAAC;IAFe,cAAO,UAEtB,CAAA;IAED,IAAiB,QAAQ,CASxB;IATD,WAAiB,QAAQ;QACrB,SAAgB,IAAI,CAAC,MAAiC;YAClD,OAAO,CAAC,IAAI,iCAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;QACnD,CAAC;QAFe,aAAI,OAEnB,CAAA;QAED,SAAgB,KAAK,CAAC,MAAkC;YACpD,OAAO,CAAC,IAAI,mCAAgB,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;QACpD,CAAC;QAFe,cAAK,QAEpB,CAAA;IAEL,CAAC,EATgB,QAAQ,GAAR,eAAQ,KAAR,eAAQ,QASxB;AACL,CAAC,EAnDgB,MAAM,
|
|
1
|
+
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../../src/maths/randomization/random.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,yCAAoC;AACpC,6CAAwC;AAQxC,+CAA0C;AAK1C,uDAAkD;AAElD,yDAAoD;AAEpD,6CAA0B;AAE1B,IAAiB,MAAM,CAmDtB;AAnDD,WAAiB,MAAM;IACnB,SAAgB,OAAO,CAAC,MAA4B;QAChD,OAAO,CAAC,IAAI,uBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC9C,CAAC;IAFe,cAAO,UAEtB,CAAA;IAED,SAAgB,KAAK,CAAC,MAA0B;QAC5C,OAAO,CAAC,IAAI,mBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC5C,CAAC;IAFe,YAAK,QAEpB,CAAA;IAED,SAAgB,QAAQ,CAAC,MAAgC;QACrD,OAAO,CAAC,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC/C,CAAC;IAFe,eAAQ,WAEvB,CAAA;IAED,SAAgB,MAAM,CAAC,IAAY,EAAE,EAAU;QAC3C,OAAO,uBAAU,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACzC,CAAC;IAFe,aAAM,SAErB,CAAA;IAED,SAAgB,SAAS,CAAC,GAAW,EAAE,SAAmB;QACtD,OAAO,uBAAU,CAAC,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;IAClD,CAAC;IAFe,gBAAS,YAExB,CAAA;IAED,SAAgB,KAAK,CAAC,GAAW;QAC7B,OAAO,uBAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IACtC,CAAC;IAFe,YAAK,QAEpB,CAAA;IAED,SAAgB,IAAI,CAAC,OAAgB;QACjC,OAAO,uBAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;IAFe,WAAI,OAEnB,CAAA;IAED,SAAgB,KAAK,CAAC,GAAU,EAAE,MAAe;QAC7C,OAAO,uBAAU,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC9C,CAAC;IAFe,YAAK,QAEpB,CAAA;IAED,SAAgB,IAAI,CAAC,GAAU;QAC3B,OAAO,uBAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;IAFe,WAAI,OAEnB,CAAA;IAED,SAAgB,OAAO,CAAC,GAAU;QAC9B,OAAO,uBAAU,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACvC,CAAC;IAFe,cAAO,UAEtB,CAAA;IAED,IAAiB,QAAQ,CASxB;IATD,WAAiB,QAAQ;QACrB,SAAgB,IAAI,CAAC,MAAiC;YAClD,OAAO,CAAC,IAAI,iCAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;QACnD,CAAC;QAFe,aAAI,OAEnB,CAAA;QAED,SAAgB,KAAK,CAAC,MAAkC;YACpD,OAAO,CAAC,IAAI,mCAAgB,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;QACpD,CAAC;QAFe,cAAK,QAEpB,CAAA;IAEL,CAAC,EATgB,QAAQ,GAAR,eAAQ,KAAR,eAAQ,QASxB;AACL,CAAC,EAnDgB,MAAM,sBAAN,MAAM,QAmDtB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare class randomCore {
|
|
2
|
-
protected _config: Object;
|
|
3
|
-
protected _defaultConfig: Object;
|
|
4
|
-
mergeConfig: (config: Object, defaultConfig: Object) => Object;
|
|
5
|
-
generate: () => unknown;
|
|
6
|
-
config: (config: Object) => randomCore;
|
|
7
|
-
}
|
|
1
|
+
export declare class randomCore {
|
|
2
|
+
protected _config: Object;
|
|
3
|
+
protected _defaultConfig: Object;
|
|
4
|
+
mergeConfig: (config: Object, defaultConfig: Object) => Object;
|
|
5
|
+
generate: () => unknown;
|
|
6
|
+
config: (config: Object) => randomCore;
|
|
7
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.randomCore = void 0;
|
|
4
|
-
class randomCore {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.mergeConfig = (config, defaultConfig) => {
|
|
7
|
-
if (config !== undefined) {
|
|
8
|
-
return { ...defaultConfig, ...config };
|
|
9
|
-
}
|
|
10
|
-
return defaultConfig;
|
|
11
|
-
};
|
|
12
|
-
this.generate = () => {
|
|
13
|
-
return undefined;
|
|
14
|
-
};
|
|
15
|
-
this.config = (config) => {
|
|
16
|
-
this._config = this.mergeConfig(config, this._defaultConfig);
|
|
17
|
-
return this;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.randomCore = randomCore;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomCore = void 0;
|
|
4
|
+
class randomCore {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.mergeConfig = (config, defaultConfig) => {
|
|
7
|
+
if (config !== undefined) {
|
|
8
|
+
return { ...defaultConfig, ...config };
|
|
9
|
+
}
|
|
10
|
+
return defaultConfig;
|
|
11
|
+
};
|
|
12
|
+
this.generate = () => {
|
|
13
|
+
return undefined;
|
|
14
|
+
};
|
|
15
|
+
this.config = (config) => {
|
|
16
|
+
this._config = this.mergeConfig(config, this._defaultConfig);
|
|
17
|
+
return this;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.randomCore = randomCore;
|
|
22
22
|
//# sourceMappingURL=randomCore.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { randomCore } from "./randomCore";
|
|
2
|
-
import { randomCoefficientConfig } from "./rndTypes";
|
|
3
|
-
import { Fraction } from "../coefficients/fraction";
|
|
4
|
-
/**
|
|
5
|
-
* Create a random monom based on a based configuration
|
|
6
|
-
*/
|
|
7
|
-
export declare class rndFraction extends randomCore {
|
|
8
|
-
protected _config: randomCoefficientConfig;
|
|
9
|
-
protected _defaultConfig: randomCoefficientConfig;
|
|
10
|
-
constructor(userConfig?: randomCoefficientConfig);
|
|
11
|
-
generate: () => Fraction;
|
|
12
|
-
}
|
|
1
|
+
import { randomCore } from "./randomCore";
|
|
2
|
+
import { randomCoefficientConfig } from "./rndTypes";
|
|
3
|
+
import { Fraction } from "../coefficients/fraction";
|
|
4
|
+
/**
|
|
5
|
+
* Create a random monom based on a based configuration
|
|
6
|
+
*/
|
|
7
|
+
export declare class rndFraction extends randomCore {
|
|
8
|
+
protected _config: randomCoefficientConfig;
|
|
9
|
+
protected _defaultConfig: randomCoefficientConfig;
|
|
10
|
+
constructor(userConfig?: randomCoefficientConfig);
|
|
11
|
+
generate: () => Fraction;
|
|
12
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rndFraction = void 0;
|
|
4
|
-
const randomCore_1 = require("./randomCore");
|
|
5
|
-
const random_1 = require("./random");
|
|
6
|
-
const fraction_1 = require("../coefficients/fraction");
|
|
7
|
-
/**
|
|
8
|
-
* Create a random monom based on a based configuration
|
|
9
|
-
*/
|
|
10
|
-
class rndFraction extends randomCore_1.randomCore {
|
|
11
|
-
constructor(userConfig) {
|
|
12
|
-
super();
|
|
13
|
-
this.generate = () => {
|
|
14
|
-
let Q = new fraction_1.Fraction();
|
|
15
|
-
if (this._config.negative) {
|
|
16
|
-
Q.numerator = random_1.Random.numberSym(this._config.max, this._config.zero);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
Q.numerator = random_1.Random.number(this._config.zero ? 0 : 1, this._config.max);
|
|
20
|
-
}
|
|
21
|
-
if (this._config.natural) {
|
|
22
|
-
Q.denominator = 1;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
let securityCount = 0;
|
|
26
|
-
while (Q.isRelative() && securityCount < 10) {
|
|
27
|
-
Q.denominator = random_1.Random.number(1, this._config.max);
|
|
28
|
-
securityCount++;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return this._config.reduced ? Q.reduce() : Q;
|
|
32
|
-
};
|
|
33
|
-
this._defaultConfig = {
|
|
34
|
-
negative: true,
|
|
35
|
-
max: 10,
|
|
36
|
-
reduced: true,
|
|
37
|
-
zero: true,
|
|
38
|
-
natural: false
|
|
39
|
-
};
|
|
40
|
-
this._config = this.mergeConfig(userConfig, this._defaultConfig);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.rndFraction = rndFraction;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rndFraction = void 0;
|
|
4
|
+
const randomCore_1 = require("./randomCore");
|
|
5
|
+
const random_1 = require("./random");
|
|
6
|
+
const fraction_1 = require("../coefficients/fraction");
|
|
7
|
+
/**
|
|
8
|
+
* Create a random monom based on a based configuration
|
|
9
|
+
*/
|
|
10
|
+
class rndFraction extends randomCore_1.randomCore {
|
|
11
|
+
constructor(userConfig) {
|
|
12
|
+
super();
|
|
13
|
+
this.generate = () => {
|
|
14
|
+
let Q = new fraction_1.Fraction();
|
|
15
|
+
if (this._config.negative) {
|
|
16
|
+
Q.numerator = random_1.Random.numberSym(this._config.max, this._config.zero);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
Q.numerator = random_1.Random.number(this._config.zero ? 0 : 1, this._config.max);
|
|
20
|
+
}
|
|
21
|
+
if (this._config.natural) {
|
|
22
|
+
Q.denominator = 1;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
let securityCount = 0;
|
|
26
|
+
while (Q.isRelative() && securityCount < 10) {
|
|
27
|
+
Q.denominator = random_1.Random.number(1, this._config.max);
|
|
28
|
+
securityCount++;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return this._config.reduced ? Q.reduce() : Q;
|
|
32
|
+
};
|
|
33
|
+
this._defaultConfig = {
|
|
34
|
+
negative: true,
|
|
35
|
+
max: 10,
|
|
36
|
+
reduced: true,
|
|
37
|
+
zero: true,
|
|
38
|
+
natural: false
|
|
39
|
+
};
|
|
40
|
+
this._config = this.mergeConfig(userConfig, this._defaultConfig);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.rndFraction = rndFraction;
|
|
44
44
|
//# sourceMappingURL=rndFraction.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { randomCore } from "./randomCore";
|
|
2
|
-
import { randomGeometryLineConfig } from "./random";
|
|
3
|
-
import { Line } from "../geometry/line";
|
|
4
|
-
/**
|
|
5
|
-
* Create a random monom based on a based configuration
|
|
6
|
-
*/
|
|
7
|
-
export declare class rndGeometryLine extends randomCore {
|
|
8
|
-
protected _config: randomGeometryLineConfig;
|
|
9
|
-
protected _defaultConfig: randomGeometryLineConfig;
|
|
10
|
-
constructor(userConfig?: randomGeometryLineConfig);
|
|
11
|
-
generate: () => Line;
|
|
12
|
-
}
|
|
1
|
+
import { randomCore } from "./randomCore";
|
|
2
|
+
import { randomGeometryLineConfig } from "./random";
|
|
3
|
+
import { Line } from "../geometry/line";
|
|
4
|
+
/**
|
|
5
|
+
* Create a random monom based on a based configuration
|
|
6
|
+
*/
|
|
7
|
+
export declare class rndGeometryLine extends randomCore {
|
|
8
|
+
protected _config: randomGeometryLineConfig;
|
|
9
|
+
protected _defaultConfig: randomGeometryLineConfig;
|
|
10
|
+
constructor(userConfig?: randomGeometryLineConfig);
|
|
11
|
+
generate: () => Line;
|
|
12
|
+
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rndGeometryLine = void 0;
|
|
4
|
-
const randomCore_1 = require("./randomCore");
|
|
5
|
-
const random_1 = require("./random");
|
|
6
|
-
const line_1 = require("../geometry/line");
|
|
7
|
-
const vector_1 = require("../geometry/vector");
|
|
8
|
-
const point_1 = require("../geometry/point");
|
|
9
|
-
/**
|
|
10
|
-
* Create a random monom based on a based configuration
|
|
11
|
-
*/
|
|
12
|
-
class rndGeometryLine extends randomCore_1.randomCore {
|
|
13
|
-
constructor(userConfig) {
|
|
14
|
-
super();
|
|
15
|
-
this.generate = () => {
|
|
16
|
-
// The A point exists.
|
|
17
|
-
const d = new vector_1.Vector(random_1.Random.numberSym(10), random_1.Random.numberSym(10));
|
|
18
|
-
while (d.isNull) {
|
|
19
|
-
d.x = random_1.Random.numberSym(10);
|
|
20
|
-
d.y = random_1.Random.numberSym(10);
|
|
21
|
-
}
|
|
22
|
-
if (this._config.slope === 1) {
|
|
23
|
-
if (d.x.sign() !== d.y.sign()) {
|
|
24
|
-
d.y.opposed();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else if (this._config.slope === -1) {
|
|
28
|
-
if (d.x.sign() !== d.y.sign()) {
|
|
29
|
-
d.y.opposed();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return new line_1.Line(new point_1.Point(this._config.A.x, this._config.A.y), d);
|
|
33
|
-
};
|
|
34
|
-
this._defaultConfig = {
|
|
35
|
-
A: {
|
|
36
|
-
x: random_1.Random.numberSym(10),
|
|
37
|
-
y: random_1.Random.numberSym(10)
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
// TODO: Strange that it raise an error
|
|
41
|
-
// @ts-ignore
|
|
42
|
-
this._config = this.mergeConfig(userConfig, this._defaultConfig);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.rndGeometryLine = rndGeometryLine;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rndGeometryLine = void 0;
|
|
4
|
+
const randomCore_1 = require("./randomCore");
|
|
5
|
+
const random_1 = require("./random");
|
|
6
|
+
const line_1 = require("../geometry/line");
|
|
7
|
+
const vector_1 = require("../geometry/vector");
|
|
8
|
+
const point_1 = require("../geometry/point");
|
|
9
|
+
/**
|
|
10
|
+
* Create a random monom based on a based configuration
|
|
11
|
+
*/
|
|
12
|
+
class rndGeometryLine extends randomCore_1.randomCore {
|
|
13
|
+
constructor(userConfig) {
|
|
14
|
+
super();
|
|
15
|
+
this.generate = () => {
|
|
16
|
+
// The A point exists.
|
|
17
|
+
const d = new vector_1.Vector(random_1.Random.numberSym(10), random_1.Random.numberSym(10));
|
|
18
|
+
while (d.isNull) {
|
|
19
|
+
d.x = random_1.Random.numberSym(10);
|
|
20
|
+
d.y = random_1.Random.numberSym(10);
|
|
21
|
+
}
|
|
22
|
+
if (this._config.slope === 1) {
|
|
23
|
+
if (d.x.sign() !== d.y.sign()) {
|
|
24
|
+
d.y.opposed();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else if (this._config.slope === -1) {
|
|
28
|
+
if (d.x.sign() !== d.y.sign()) {
|
|
29
|
+
d.y.opposed();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return new line_1.Line(new point_1.Point(this._config.A.x, this._config.A.y), d);
|
|
33
|
+
};
|
|
34
|
+
this._defaultConfig = {
|
|
35
|
+
A: {
|
|
36
|
+
x: random_1.Random.numberSym(10),
|
|
37
|
+
y: random_1.Random.numberSym(10)
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
// TODO: Strange that it raise an error
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
this._config = this.mergeConfig(userConfig, this._defaultConfig);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.rndGeometryLine = rndGeometryLine;
|
|
46
46
|
//# sourceMappingURL=rndGeometryLine.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { randomCore } from "./randomCore";
|
|
2
|
-
import { randomGeometryPointConfig } from "./random";
|
|
3
|
-
import { Point } from "../geometry/point";
|
|
4
|
-
/**
|
|
5
|
-
* Create a random monom based on a based configuration
|
|
6
|
-
*/
|
|
7
|
-
export declare class rndGeometryPoint extends randomCore {
|
|
8
|
-
protected _config: randomGeometryPointConfig;
|
|
9
|
-
protected _defaultConfig: randomGeometryPointConfig;
|
|
10
|
-
constructor(userConfig?: randomGeometryPointConfig);
|
|
11
|
-
generate: () => Point;
|
|
12
|
-
}
|
|
1
|
+
import { randomCore } from "./randomCore";
|
|
2
|
+
import { randomGeometryPointConfig } from "./random";
|
|
3
|
+
import { Point } from "../geometry/point";
|
|
4
|
+
/**
|
|
5
|
+
* Create a random monom based on a based configuration
|
|
6
|
+
*/
|
|
7
|
+
export declare class rndGeometryPoint extends randomCore {
|
|
8
|
+
protected _config: randomGeometryPointConfig;
|
|
9
|
+
protected _defaultConfig: randomGeometryPointConfig;
|
|
10
|
+
constructor(userConfig?: randomGeometryPointConfig);
|
|
11
|
+
generate: () => Point;
|
|
12
|
+
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rndGeometryPoint = void 0;
|
|
4
|
-
const randomCore_1 = require("./randomCore");
|
|
5
|
-
const random_1 = require("./random");
|
|
6
|
-
const point_1 = require("../geometry/point");
|
|
7
|
-
const fraction_1 = require("../coefficients/fraction");
|
|
8
|
-
/**
|
|
9
|
-
* Create a random monom based on a based configuration
|
|
10
|
-
*/
|
|
11
|
-
class rndGeometryPoint extends randomCore_1.randomCore {
|
|
12
|
-
constructor(userConfig) {
|
|
13
|
-
super();
|
|
14
|
-
this.generate = () => {
|
|
15
|
-
let x, y, zeroX = this._config.axis === true || this._config.axis === 'x', zeroY = this._config.axis === true || this._config.axis === 'y';
|
|
16
|
-
x = this._config.fraction ?
|
|
17
|
-
random_1.Random.fraction({ max: this._config.max, zero: zeroX }) :
|
|
18
|
-
new fraction_1.Fraction(random_1.Random.numberSym(this._config.max, zeroX));
|
|
19
|
-
y = this._config.fraction ?
|
|
20
|
-
random_1.Random.fraction({ max: this._config.max, zero: zeroY }) :
|
|
21
|
-
new fraction_1.Fraction(random_1.Random.numberSym(this._config.max, zeroY));
|
|
22
|
-
if (+this._config.quadrant === 1) {
|
|
23
|
-
x.abs();
|
|
24
|
-
y.abs();
|
|
25
|
-
}
|
|
26
|
-
if (+this._config.quadrant === 2) {
|
|
27
|
-
if (x.isPositive()) {
|
|
28
|
-
x.opposed();
|
|
29
|
-
}
|
|
30
|
-
if (y.isNegative()) {
|
|
31
|
-
y.opposed();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (+this._config.quadrant === 3) {
|
|
35
|
-
if (x.isPositive()) {
|
|
36
|
-
x.opposed();
|
|
37
|
-
}
|
|
38
|
-
if (y.isPositive()) {
|
|
39
|
-
y.opposed();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (+this._config.quadrant === 4) {
|
|
43
|
-
if (x.isNegative()) {
|
|
44
|
-
x.opposed();
|
|
45
|
-
}
|
|
46
|
-
if (y.isPositive()) {
|
|
47
|
-
y.opposed();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return new point_1.Point(x, y);
|
|
51
|
-
};
|
|
52
|
-
this._defaultConfig = {
|
|
53
|
-
axis: true,
|
|
54
|
-
fraction: false,
|
|
55
|
-
max: 10
|
|
56
|
-
};
|
|
57
|
-
this._config = this.mergeConfig(userConfig, this._defaultConfig);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.rndGeometryPoint = rndGeometryPoint;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rndGeometryPoint = void 0;
|
|
4
|
+
const randomCore_1 = require("./randomCore");
|
|
5
|
+
const random_1 = require("./random");
|
|
6
|
+
const point_1 = require("../geometry/point");
|
|
7
|
+
const fraction_1 = require("../coefficients/fraction");
|
|
8
|
+
/**
|
|
9
|
+
* Create a random monom based on a based configuration
|
|
10
|
+
*/
|
|
11
|
+
class rndGeometryPoint extends randomCore_1.randomCore {
|
|
12
|
+
constructor(userConfig) {
|
|
13
|
+
super();
|
|
14
|
+
this.generate = () => {
|
|
15
|
+
let x, y, zeroX = this._config.axis === true || this._config.axis === 'x', zeroY = this._config.axis === true || this._config.axis === 'y';
|
|
16
|
+
x = this._config.fraction ?
|
|
17
|
+
random_1.Random.fraction({ max: this._config.max, zero: zeroX }) :
|
|
18
|
+
new fraction_1.Fraction(random_1.Random.numberSym(this._config.max, zeroX));
|
|
19
|
+
y = this._config.fraction ?
|
|
20
|
+
random_1.Random.fraction({ max: this._config.max, zero: zeroY }) :
|
|
21
|
+
new fraction_1.Fraction(random_1.Random.numberSym(this._config.max, zeroY));
|
|
22
|
+
if (+this._config.quadrant === 1) {
|
|
23
|
+
x.abs();
|
|
24
|
+
y.abs();
|
|
25
|
+
}
|
|
26
|
+
if (+this._config.quadrant === 2) {
|
|
27
|
+
if (x.isPositive()) {
|
|
28
|
+
x.opposed();
|
|
29
|
+
}
|
|
30
|
+
if (y.isNegative()) {
|
|
31
|
+
y.opposed();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (+this._config.quadrant === 3) {
|
|
35
|
+
if (x.isPositive()) {
|
|
36
|
+
x.opposed();
|
|
37
|
+
}
|
|
38
|
+
if (y.isPositive()) {
|
|
39
|
+
y.opposed();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (+this._config.quadrant === 4) {
|
|
43
|
+
if (x.isNegative()) {
|
|
44
|
+
x.opposed();
|
|
45
|
+
}
|
|
46
|
+
if (y.isPositive()) {
|
|
47
|
+
y.opposed();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return new point_1.Point(x, y);
|
|
51
|
+
};
|
|
52
|
+
this._defaultConfig = {
|
|
53
|
+
axis: true,
|
|
54
|
+
fraction: false,
|
|
55
|
+
max: 10
|
|
56
|
+
};
|
|
57
|
+
this._config = this.mergeConfig(userConfig, this._defaultConfig);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.rndGeometryPoint = rndGeometryPoint;
|
|
61
61
|
//# sourceMappingURL=rndGeometryPoint.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export declare class rndHelpers {
|
|
2
|
-
/**
|
|
3
|
-
* Random boolean with a percent ratio
|
|
4
|
-
* @param percent
|
|
5
|
-
*/
|
|
6
|
-
static randomBool(percent?: number): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Random integer between two values.
|
|
9
|
-
* @param a (number) : From this value to the second value. If the second is ommited, this value is the max value.
|
|
10
|
-
* @param b (number) : To this value. If this is ommited.
|
|
11
|
-
*/
|
|
12
|
-
static randomInt(a: number, b?: number): number;
|
|
13
|
-
/**
|
|
14
|
-
* Random integer between -max and max value.
|
|
15
|
-
* @param max (number) : determine the limits.
|
|
16
|
-
* @param zero (bool) : determine if zero is allowed or not.
|
|
17
|
-
*/
|
|
18
|
-
static randomIntSym(max: number, zero?: boolean): number;
|
|
19
|
-
static randomPrime(max: number): number;
|
|
20
|
-
static randomArray(arr: any[], number?: number): any[];
|
|
21
|
-
static randomItem(arr: any[]): any;
|
|
22
|
-
static shuffleArray(arr: any[]): any[];
|
|
23
|
-
}
|
|
1
|
+
export declare class rndHelpers {
|
|
2
|
+
/**
|
|
3
|
+
* Random boolean with a percent ratio
|
|
4
|
+
* @param percent
|
|
5
|
+
*/
|
|
6
|
+
static randomBool(percent?: number): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Random integer between two values.
|
|
9
|
+
* @param a (number) : From this value to the second value. If the second is ommited, this value is the max value.
|
|
10
|
+
* @param b (number) : To this value. If this is ommited.
|
|
11
|
+
*/
|
|
12
|
+
static randomInt(a: number, b?: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Random integer between -max and max value.
|
|
15
|
+
* @param max (number) : determine the limits.
|
|
16
|
+
* @param zero (bool) : determine if zero is allowed or not.
|
|
17
|
+
*/
|
|
18
|
+
static randomIntSym(max: number, zero?: boolean): number;
|
|
19
|
+
static randomPrime(max: number): number;
|
|
20
|
+
static randomArray(arr: any[], number?: number): any[];
|
|
21
|
+
static randomItem(arr: any[]): any;
|
|
22
|
+
static shuffleArray(arr: any[]): any[];
|
|
23
|
+
}
|