@pie-lib/graphing-utils 1.21.2-next.11 → 1.21.2-next.172
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/CHANGELOG.md +13 -55
- package/esm/index.js +89 -87
- package/esm/index.js.map +1 -1
- package/lib/index.js +44 -112
- package/lib/index.js.map +1 -1
- package/package.json +3 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [2.0.0-next.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.21.2-next.0...@pie-lib/graphing-utils@2.0.0-next.0) (2026-01-19)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## [1.21.2-next.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.35.0-mui-update.0...@pie-lib/graphing-utils@1.21.2-next.0) (2026-01-19)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
17
17
|
|
|
@@ -19,117 +19,75 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
## [1.21.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.17.0...@pie-lib/graphing-utils@1.21.1) (2025-10-22)
|
|
23
23
|
|
|
24
24
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
25
25
|
|
|
26
|
+
# [1.21.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.17.0...@pie-lib/graphing-utils@1.21.0) (2025-10-16)
|
|
26
27
|
|
|
28
|
+
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
27
29
|
|
|
30
|
+
# [1.20.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.17.0...@pie-lib/graphing-utils@1.20.0) (2025-10-16)
|
|
28
31
|
|
|
32
|
+
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
29
33
|
|
|
30
34
|
# [1.19.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.17.0...@pie-lib/graphing-utils@1.19.0) (2025-10-16)
|
|
31
35
|
|
|
32
36
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
38
|
# [1.18.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.17.0...@pie-lib/graphing-utils@1.18.0) (2025-10-16)
|
|
39
39
|
|
|
40
40
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
42
|
# [1.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.33...@pie-lib/graphing-utils@1.17.0) (2025-09-25)
|
|
47
43
|
|
|
48
|
-
|
|
49
44
|
### Bug Fixes
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
53
47
|
|
|
54
48
|
### Features
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
61
51
|
|
|
62
52
|
# [1.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.15.0...@pie-lib/graphing-utils@1.16.0) (2025-09-18)
|
|
63
53
|
|
|
64
54
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
65
55
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
56
|
# [1.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.14.0...@pie-lib/graphing-utils@1.15.0) (2025-09-18)
|
|
71
57
|
|
|
72
58
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
73
59
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
60
|
# [1.14.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.33...@pie-lib/graphing-utils@1.14.0) (2025-09-18)
|
|
79
61
|
|
|
80
|
-
|
|
81
62
|
### Bug Fixes
|
|
82
63
|
|
|
83
|
-
|
|
84
|
-
|
|
64
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
85
65
|
|
|
86
66
|
### Features
|
|
87
67
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
68
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
93
69
|
|
|
94
70
|
# [1.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.12.0...@pie-lib/graphing-utils@1.13.0) (2025-09-17)
|
|
95
71
|
|
|
96
72
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
97
73
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
74
|
# [1.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.11.0...@pie-lib/graphing-utils@1.12.0) (2025-09-17)
|
|
103
75
|
|
|
104
76
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
105
77
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
78
|
# [1.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.10.1...@pie-lib/graphing-utils@1.11.0) (2025-09-17)
|
|
111
79
|
|
|
112
80
|
**Note:** Version bump only for package @pie-lib/graphing-utils
|
|
113
81
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
82
|
## [1.10.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.33...@pie-lib/graphing-utils@1.10.1) (2025-08-11)
|
|
119
83
|
|
|
120
|
-
|
|
121
84
|
### Bug Fixes
|
|
122
85
|
|
|
123
|
-
|
|
124
|
-
|
|
86
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
125
87
|
|
|
126
88
|
### Features
|
|
127
89
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
90
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
133
91
|
|
|
134
92
|
# [1.10.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.33...@pie-lib/graphing-utils@1.10.0) (2025-08-07)
|
|
135
93
|
|
package/esm/index.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
function _extends() {
|
|
2
|
-
_extends = Object.assign
|
|
3
|
-
for (var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
for (var key in source) {
|
|
7
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
8
|
-
target[key] = source[key];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
2
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
3
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
4
|
+
var t = arguments[e];
|
|
5
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
11
6
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return _extends.apply(this, arguments);
|
|
7
|
+
return n;
|
|
8
|
+
}, _extends.apply(null, arguments);
|
|
17
9
|
}
|
|
18
10
|
|
|
19
11
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -55,7 +47,7 @@ function requireMs () {
|
|
|
55
47
|
* @api public
|
|
56
48
|
*/
|
|
57
49
|
|
|
58
|
-
ms = function(val, options) {
|
|
50
|
+
ms = function (val, options) {
|
|
59
51
|
options = options || {};
|
|
60
52
|
var type = typeof val;
|
|
61
53
|
if (type === 'string' && val.length > 0) {
|
|
@@ -368,24 +360,62 @@ function requireCommon () {
|
|
|
368
360
|
createDebug.names = [];
|
|
369
361
|
createDebug.skips = [];
|
|
370
362
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
363
|
+
const split = (typeof namespaces === 'string' ? namespaces : '')
|
|
364
|
+
.trim()
|
|
365
|
+
.replace(/\s+/g, ',')
|
|
366
|
+
.split(',')
|
|
367
|
+
.filter(Boolean);
|
|
374
368
|
|
|
375
|
-
for (
|
|
376
|
-
if (
|
|
377
|
-
|
|
378
|
-
|
|
369
|
+
for (const ns of split) {
|
|
370
|
+
if (ns[0] === '-') {
|
|
371
|
+
createDebug.skips.push(ns.slice(1));
|
|
372
|
+
} else {
|
|
373
|
+
createDebug.names.push(ns);
|
|
379
374
|
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
380
377
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
378
|
+
/**
|
|
379
|
+
* Checks if the given string matches a namespace template, honoring
|
|
380
|
+
* asterisks as wildcards.
|
|
381
|
+
*
|
|
382
|
+
* @param {String} search
|
|
383
|
+
* @param {String} template
|
|
384
|
+
* @return {Boolean}
|
|
385
|
+
*/
|
|
386
|
+
function matchesTemplate(search, template) {
|
|
387
|
+
let searchIndex = 0;
|
|
388
|
+
let templateIndex = 0;
|
|
389
|
+
let starIndex = -1;
|
|
390
|
+
let matchIndex = 0;
|
|
391
|
+
|
|
392
|
+
while (searchIndex < search.length) {
|
|
393
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
|
|
394
|
+
// Match character or proceed with wildcard
|
|
395
|
+
if (template[templateIndex] === '*') {
|
|
396
|
+
starIndex = templateIndex;
|
|
397
|
+
matchIndex = searchIndex;
|
|
398
|
+
templateIndex++; // Skip the '*'
|
|
399
|
+
} else {
|
|
400
|
+
searchIndex++;
|
|
401
|
+
templateIndex++;
|
|
402
|
+
}
|
|
403
|
+
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
|
|
404
|
+
// Backtrack to the last '*' and try to match more characters
|
|
405
|
+
templateIndex = starIndex + 1;
|
|
406
|
+
matchIndex++;
|
|
407
|
+
searchIndex = matchIndex;
|
|
385
408
|
} else {
|
|
386
|
-
|
|
409
|
+
return false; // No match
|
|
387
410
|
}
|
|
388
411
|
}
|
|
412
|
+
|
|
413
|
+
// Handle trailing '*' in template
|
|
414
|
+
while (templateIndex < template.length && template[templateIndex] === '*') {
|
|
415
|
+
templateIndex++;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return templateIndex === template.length;
|
|
389
419
|
}
|
|
390
420
|
|
|
391
421
|
/**
|
|
@@ -396,8 +426,8 @@ function requireCommon () {
|
|
|
396
426
|
*/
|
|
397
427
|
function disable() {
|
|
398
428
|
const namespaces = [
|
|
399
|
-
...createDebug.names
|
|
400
|
-
...createDebug.skips.map(
|
|
429
|
+
...createDebug.names,
|
|
430
|
+
...createDebug.skips.map(namespace => '-' + namespace)
|
|
401
431
|
].join(',');
|
|
402
432
|
createDebug.enable('');
|
|
403
433
|
return namespaces;
|
|
@@ -411,21 +441,14 @@ function requireCommon () {
|
|
|
411
441
|
* @api public
|
|
412
442
|
*/
|
|
413
443
|
function enabled(name) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
let i;
|
|
419
|
-
let len;
|
|
420
|
-
|
|
421
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
422
|
-
if (createDebug.skips[i].test(name)) {
|
|
444
|
+
for (const skip of createDebug.skips) {
|
|
445
|
+
if (matchesTemplate(name, skip)) {
|
|
423
446
|
return false;
|
|
424
447
|
}
|
|
425
448
|
}
|
|
426
449
|
|
|
427
|
-
for (
|
|
428
|
-
if (
|
|
450
|
+
for (const ns of createDebug.names) {
|
|
451
|
+
if (matchesTemplate(name, ns)) {
|
|
429
452
|
return true;
|
|
430
453
|
}
|
|
431
454
|
}
|
|
@@ -433,19 +456,6 @@ function requireCommon () {
|
|
|
433
456
|
return false;
|
|
434
457
|
}
|
|
435
458
|
|
|
436
|
-
/**
|
|
437
|
-
* Convert regexp to namespace
|
|
438
|
-
*
|
|
439
|
-
* @param {RegExp} regxep
|
|
440
|
-
* @return {String} namespace
|
|
441
|
-
* @api private
|
|
442
|
-
*/
|
|
443
|
-
function toNamespace(regexp) {
|
|
444
|
-
return regexp.toString()
|
|
445
|
-
.substring(2, regexp.toString().length - 2)
|
|
446
|
-
.replace(/\.\*\?$/, '*');
|
|
447
|
-
}
|
|
448
|
-
|
|
449
459
|
/**
|
|
450
460
|
* Coerce `val`.
|
|
451
461
|
*
|
|
@@ -610,14 +620,17 @@ function requireBrowser () {
|
|
|
610
620
|
return false;
|
|
611
621
|
}
|
|
612
622
|
|
|
623
|
+
let m;
|
|
624
|
+
|
|
613
625
|
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
614
626
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
627
|
+
// eslint-disable-next-line no-return-assign
|
|
615
628
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
616
629
|
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
617
630
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
618
631
|
// Is firefox >= v31?
|
|
619
632
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
620
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(
|
|
633
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
|
|
621
634
|
// Double check webkit in userAgent just in case we are in a worker
|
|
622
635
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
623
636
|
}
|
|
@@ -701,7 +714,7 @@ function requireBrowser () {
|
|
|
701
714
|
function load() {
|
|
702
715
|
let r;
|
|
703
716
|
try {
|
|
704
|
-
r = exports$1.storage.getItem('debug');
|
|
717
|
+
r = exports$1.storage.getItem('debug') || exports$1.storage.getItem('DEBUG') ;
|
|
705
718
|
} catch (error) {
|
|
706
719
|
// Swallow
|
|
707
720
|
// XXX (@Qix-) should we be logging these?
|
|
@@ -18303,42 +18316,37 @@ const getAmplitudeAndFreq = (root, edge) => {
|
|
|
18303
18316
|
amplitude: 0
|
|
18304
18317
|
};
|
|
18305
18318
|
}
|
|
18306
|
-
|
|
18307
18319
|
if (root.x == edge.x) {
|
|
18308
18320
|
return {
|
|
18309
18321
|
freq: 0,
|
|
18310
18322
|
amplitude: 0
|
|
18311
18323
|
};
|
|
18312
18324
|
}
|
|
18313
|
-
|
|
18314
18325
|
const r = new Point(root.x, root.y);
|
|
18315
18326
|
const e = new Point(edge.x, edge.y);
|
|
18316
|
-
const d = e.sub(r);
|
|
18317
|
-
|
|
18327
|
+
const d = e.sub(r);
|
|
18328
|
+
// edge point describes 1/4 of the freq
|
|
18318
18329
|
return {
|
|
18319
18330
|
freq: d.x * 4,
|
|
18320
18331
|
amplitude: d.y
|
|
18321
18332
|
};
|
|
18322
18333
|
};
|
|
18334
|
+
|
|
18323
18335
|
/**
|
|
18324
18336
|
* build the x points with root as the anchor.
|
|
18325
18337
|
*/
|
|
18326
|
-
|
|
18327
18338
|
const xPoints = (root, freq, min, max) => {
|
|
18328
18339
|
freq = Math.abs(freq);
|
|
18329
18340
|
log('[xPoints] root:', root, 'freq:', freq, ' min:', min, ' max:', max);
|
|
18330
|
-
|
|
18331
18341
|
const leftpoints = _.rangeRight(root, min - freq, freq * -1);
|
|
18332
|
-
|
|
18333
18342
|
const rightpoints = _.range(root + freq, max + freq, freq);
|
|
18334
|
-
|
|
18335
18343
|
return _.concat(leftpoints, rightpoints);
|
|
18336
18344
|
};
|
|
18345
|
+
|
|
18337
18346
|
/**
|
|
18338
18347
|
* Calculate y for x value using amp, freq and shift
|
|
18339
18348
|
* https://www.desmos.com/calculator/f1psfoiiv6
|
|
18340
18349
|
*/
|
|
18341
|
-
|
|
18342
18350
|
const sinY = (amplitude, freq, shift) => x => {
|
|
18343
18351
|
shift = _extends({
|
|
18344
18352
|
phase: 0,
|
|
@@ -18351,11 +18359,11 @@ const sinY = (amplitude, freq, shift) => x => {
|
|
|
18351
18359
|
const sinFloat = parseFloat(sin).toFixed(10);
|
|
18352
18360
|
return amplitude * sinFloat + shift.vertical;
|
|
18353
18361
|
};
|
|
18362
|
+
|
|
18354
18363
|
/**
|
|
18355
18364
|
* You need three points for the quadratic eq, so we mirror the edge point
|
|
18356
18365
|
* https://www.desmos.com/calculator/xhz1xqgpca
|
|
18357
18366
|
*/
|
|
18358
|
-
|
|
18359
18367
|
const parabolaFromTwoPoints = (root, edge) => {
|
|
18360
18368
|
edge = edge || _extends({}, root);
|
|
18361
18369
|
const mirrorEdge = {
|
|
@@ -18375,7 +18383,6 @@ const parabolaFromThreePoints = (one, two, three) => {
|
|
|
18375
18383
|
return parabola(a, b, c);
|
|
18376
18384
|
};
|
|
18377
18385
|
/** derive a,b,c from the 3 points */
|
|
18378
|
-
|
|
18379
18386
|
const pointsToABC = (one, two, three) => {
|
|
18380
18387
|
const a1 = Math.pow(one.x, 2) * -1 + Math.pow(two.x, 2);
|
|
18381
18388
|
const b1 = one.x * -1 + two.x;
|
|
@@ -18395,52 +18402,50 @@ const pointsToABC = (one, two, three) => {
|
|
|
18395
18402
|
c
|
|
18396
18403
|
};
|
|
18397
18404
|
};
|
|
18405
|
+
|
|
18398
18406
|
/**
|
|
18399
18407
|
* y=ax^2+bx+c
|
|
18400
18408
|
*/
|
|
18401
|
-
|
|
18402
18409
|
const parabola = (a, b, c) => x => a * Math.pow(x, 2) + b * x + c;
|
|
18410
|
+
|
|
18403
18411
|
/**
|
|
18404
18412
|
* Absolute value from two points Root (Vertex) the point where the two rays intersect and edge One point on a ray.
|
|
18405
18413
|
* @param root 1st point selected on graph
|
|
18406
18414
|
* @param edge 2nd point selected on graph
|
|
18407
18415
|
* https://www.desmos.com/calculator/rarxiatpip
|
|
18408
18416
|
*/
|
|
18409
|
-
|
|
18410
18417
|
const absoluteFromTwoPoints = (root, edge) => {
|
|
18411
18418
|
edge = edge || _extends({}, root);
|
|
18412
18419
|
const a = pointsToAForAbsolute(root, edge);
|
|
18413
18420
|
return absolute(a, root.x, root.y);
|
|
18414
18421
|
};
|
|
18422
|
+
|
|
18415
18423
|
/*
|
|
18416
18424
|
* Finds value of a in y=a*abs(x-h)+k function
|
|
18417
18425
|
* @param one 1st point
|
|
18418
18426
|
* @param two 2nd point
|
|
18419
18427
|
* */
|
|
18420
|
-
|
|
18421
18428
|
const pointsToAForAbsolute = (one, two) => {
|
|
18422
18429
|
const y1 = two.y - one.y;
|
|
18423
18430
|
const x1 = two.x - one.x;
|
|
18424
18431
|
let a = y1 / x1;
|
|
18425
|
-
|
|
18426
18432
|
if (two.x < one.x) {
|
|
18427
18433
|
a = a * -1;
|
|
18428
18434
|
}
|
|
18429
|
-
|
|
18430
18435
|
return a;
|
|
18431
18436
|
};
|
|
18437
|
+
|
|
18432
18438
|
/**
|
|
18433
18439
|
* y=a*abs(x-h)+k
|
|
18434
18440
|
*/
|
|
18435
|
-
|
|
18436
18441
|
const absolute = (a, h, k) => x => a * Math.abs(x - h) + k;
|
|
18442
|
+
|
|
18437
18443
|
/**
|
|
18438
18444
|
* Exponential from two points on exponential graph.
|
|
18439
18445
|
* @param root 1st point selected on graph
|
|
18440
18446
|
* @param edge 2nd point selected on graph
|
|
18441
18447
|
* https://www.desmos.com/calculator/3fisjexbvp
|
|
18442
18448
|
*/
|
|
18443
|
-
|
|
18444
18449
|
const exponentialFromTwoPoints = (root, edge) => {
|
|
18445
18450
|
edge = edge || _extends({}, root);
|
|
18446
18451
|
const {
|
|
@@ -18449,12 +18454,12 @@ const exponentialFromTwoPoints = (root, edge) => {
|
|
|
18449
18454
|
} = pointsToABForExponential(root, edge);
|
|
18450
18455
|
return exponential(a, b);
|
|
18451
18456
|
};
|
|
18457
|
+
|
|
18452
18458
|
/*
|
|
18453
18459
|
* Finds value of a and b in y=a*(b)^x function
|
|
18454
18460
|
* @param one 1st point
|
|
18455
18461
|
* @param two 2nd point
|
|
18456
18462
|
* */
|
|
18457
|
-
|
|
18458
18463
|
const pointsToABForExponential = (one, two) => {
|
|
18459
18464
|
const p = one.y / two.y;
|
|
18460
18465
|
const r = 1 / (one.x - two.x);
|
|
@@ -18465,11 +18470,12 @@ const pointsToABForExponential = (one, two) => {
|
|
|
18465
18470
|
b
|
|
18466
18471
|
};
|
|
18467
18472
|
};
|
|
18473
|
+
|
|
18468
18474
|
/**
|
|
18469
18475
|
* y=a*(b)^x
|
|
18470
18476
|
*/
|
|
18471
|
-
|
|
18472
18477
|
const exponential = (a, b) => x => a * Math.pow(b, x);
|
|
18478
|
+
|
|
18473
18479
|
/**
|
|
18474
18480
|
* Generate a set of data points, add spacing before min and after max if there is space between minx + min and maxX and max
|
|
18475
18481
|
* @param {*} domain
|
|
@@ -18479,7 +18485,6 @@ const exponential = (a, b) => x => a * Math.pow(b, x);
|
|
|
18479
18485
|
* @param {*} yFn
|
|
18480
18486
|
* @param {*} excludeOutsidePoints
|
|
18481
18487
|
*/
|
|
18482
|
-
|
|
18483
18488
|
const buildDataPoints = (domain, range, root, edge, yFn, excludeOutsidePoints = false) => {
|
|
18484
18489
|
log('[buildDataPoints] domain:', domain, 'range:', range, 'root:', root, 'edge:', edge);
|
|
18485
18490
|
domain = _extends({
|
|
@@ -18497,40 +18502,37 @@ const buildDataPoints = (domain, range, root, edge, yFn, excludeOutsidePoints =
|
|
|
18497
18502
|
const xPts = xPoints(minX, domain.step, domain.min - domain.step, domain.max + domain.step);
|
|
18498
18503
|
log('[buildDataPoints]:xPts:', xPts);
|
|
18499
18504
|
let startIndex = -1;
|
|
18500
|
-
let endIndex = -1;
|
|
18505
|
+
let endIndex = -1;
|
|
18501
18506
|
|
|
18507
|
+
// generate points based on the yFn
|
|
18502
18508
|
const points = xPts.map(v => new Point(v, yFn(v)));
|
|
18503
|
-
|
|
18504
18509
|
if (!excludeOutsidePoints) {
|
|
18505
18510
|
return points;
|
|
18506
|
-
}
|
|
18507
|
-
|
|
18511
|
+
}
|
|
18508
18512
|
|
|
18513
|
+
// exclude the points with y outside range min and max
|
|
18509
18514
|
const filteredPoints = points.reduce((acc, val, index) => {
|
|
18510
18515
|
if (val.y >= range.min - range.step && val.y <= range.max + range.step) {
|
|
18511
18516
|
if (startIndex === -1) {
|
|
18512
18517
|
startIndex = index;
|
|
18513
18518
|
}
|
|
18514
|
-
|
|
18515
18519
|
if (endIndex < index) {
|
|
18516
18520
|
endIndex = index;
|
|
18517
18521
|
}
|
|
18518
|
-
|
|
18519
18522
|
return [...acc, val];
|
|
18520
18523
|
}
|
|
18521
|
-
|
|
18522
18524
|
return acc;
|
|
18523
|
-
}, []);
|
|
18525
|
+
}, []);
|
|
18524
18526
|
|
|
18527
|
+
// add the first value outside range min and max smaller than range.min if exists
|
|
18525
18528
|
if (startIndex - 1 >= 0) {
|
|
18526
18529
|
filteredPoints.unshift(points[startIndex - 1]);
|
|
18527
|
-
}
|
|
18528
|
-
|
|
18530
|
+
}
|
|
18529
18531
|
|
|
18532
|
+
// add the first value outside range min and max greater than range.min if exists
|
|
18530
18533
|
if (endIndex + 1 <= points.length - 1) {
|
|
18531
18534
|
filteredPoints.push(points[endIndex + 1]);
|
|
18532
18535
|
}
|
|
18533
|
-
|
|
18534
18536
|
return points;
|
|
18535
18537
|
};
|
|
18536
18538
|
var index = {
|