@pie-lib/graphing-utils 1.18.0 → 1.18.3
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/esm/index.js +76 -403
- package/esm/index.js.map +1 -1
- package/package.json +2 -2
package/esm/index.js
CHANGED
|
@@ -1,354 +1,28 @@
|
|
|
1
1
|
import debug from 'debug';
|
|
2
|
+
import Point from '@mapbox/point-geometry';
|
|
2
3
|
import _ from 'lodash';
|
|
3
4
|
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
enumerable: true,
|
|
9
|
-
configurable: true,
|
|
10
|
-
writable: true
|
|
11
|
-
});
|
|
12
|
-
} else {
|
|
13
|
-
obj[key] = value;
|
|
14
|
-
}
|
|
5
|
+
function _extends() {
|
|
6
|
+
_extends = Object.assign || function (target) {
|
|
7
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8
|
+
var source = arguments[i];
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
for (var key in source) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
+
target[key] = source[key];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
var hasRequiredPointGeometry;
|
|
25
|
-
|
|
26
|
-
function requirePointGeometry () {
|
|
27
|
-
if (hasRequiredPointGeometry) return pointGeometry;
|
|
28
|
-
hasRequiredPointGeometry = 1;
|
|
29
|
-
|
|
30
|
-
pointGeometry = Point;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A standalone point geometry with useful accessor, comparison, and
|
|
34
|
-
* modification methods.
|
|
35
|
-
*
|
|
36
|
-
* @class Point
|
|
37
|
-
* @param {Number} x the x-coordinate. this could be longitude or screen
|
|
38
|
-
* pixels, or any other sort of unit.
|
|
39
|
-
* @param {Number} y the y-coordinate. this could be latitude or screen
|
|
40
|
-
* pixels, or any other sort of unit.
|
|
41
|
-
* @example
|
|
42
|
-
* var point = new Point(-77, 38);
|
|
43
|
-
*/
|
|
44
|
-
function Point(x, y) {
|
|
45
|
-
this.x = x;
|
|
46
|
-
this.y = y;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
Point.prototype = {
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Clone this point, returning a new point that can be modified
|
|
53
|
-
* without affecting the old one.
|
|
54
|
-
* @return {Point} the clone
|
|
55
|
-
*/
|
|
56
|
-
clone: function() { return new Point(this.x, this.y); },
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Add this point's x & y coordinates to another point,
|
|
60
|
-
* yielding a new point.
|
|
61
|
-
* @param {Point} p the other point
|
|
62
|
-
* @return {Point} output point
|
|
63
|
-
*/
|
|
64
|
-
add: function(p) { return this.clone()._add(p); },
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Subtract this point's x & y coordinates to from point,
|
|
68
|
-
* yielding a new point.
|
|
69
|
-
* @param {Point} p the other point
|
|
70
|
-
* @return {Point} output point
|
|
71
|
-
*/
|
|
72
|
-
sub: function(p) { return this.clone()._sub(p); },
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Multiply this point's x & y coordinates by point,
|
|
76
|
-
* yielding a new point.
|
|
77
|
-
* @param {Point} p the other point
|
|
78
|
-
* @return {Point} output point
|
|
79
|
-
*/
|
|
80
|
-
multByPoint: function(p) { return this.clone()._multByPoint(p); },
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Divide this point's x & y coordinates by point,
|
|
84
|
-
* yielding a new point.
|
|
85
|
-
* @param {Point} p the other point
|
|
86
|
-
* @return {Point} output point
|
|
87
|
-
*/
|
|
88
|
-
divByPoint: function(p) { return this.clone()._divByPoint(p); },
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Multiply this point's x & y coordinates by a factor,
|
|
92
|
-
* yielding a new point.
|
|
93
|
-
* @param {Point} k factor
|
|
94
|
-
* @return {Point} output point
|
|
95
|
-
*/
|
|
96
|
-
mult: function(k) { return this.clone()._mult(k); },
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Divide this point's x & y coordinates by a factor,
|
|
100
|
-
* yielding a new point.
|
|
101
|
-
* @param {Point} k factor
|
|
102
|
-
* @return {Point} output point
|
|
103
|
-
*/
|
|
104
|
-
div: function(k) { return this.clone()._div(k); },
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Rotate this point around the 0, 0 origin by an angle a,
|
|
108
|
-
* given in radians
|
|
109
|
-
* @param {Number} a angle to rotate around, in radians
|
|
110
|
-
* @return {Point} output point
|
|
111
|
-
*/
|
|
112
|
-
rotate: function(a) { return this.clone()._rotate(a); },
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Rotate this point around p point by an angle a,
|
|
116
|
-
* given in radians
|
|
117
|
-
* @param {Number} a angle to rotate around, in radians
|
|
118
|
-
* @param {Point} p Point to rotate around
|
|
119
|
-
* @return {Point} output point
|
|
120
|
-
*/
|
|
121
|
-
rotateAround: function(a,p) { return this.clone()._rotateAround(a,p); },
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Multiply this point by a 4x1 transformation matrix
|
|
125
|
-
* @param {Array<Number>} m transformation matrix
|
|
126
|
-
* @return {Point} output point
|
|
127
|
-
*/
|
|
128
|
-
matMult: function(m) { return this.clone()._matMult(m); },
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Calculate this point but as a unit vector from 0, 0, meaning
|
|
132
|
-
* that the distance from the resulting point to the 0, 0
|
|
133
|
-
* coordinate will be equal to 1 and the angle from the resulting
|
|
134
|
-
* point to the 0, 0 coordinate will be the same as before.
|
|
135
|
-
* @return {Point} unit vector point
|
|
136
|
-
*/
|
|
137
|
-
unit: function() { return this.clone()._unit(); },
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Compute a perpendicular point, where the new y coordinate
|
|
141
|
-
* is the old x coordinate and the new x coordinate is the old y
|
|
142
|
-
* coordinate multiplied by -1
|
|
143
|
-
* @return {Point} perpendicular point
|
|
144
|
-
*/
|
|
145
|
-
perp: function() { return this.clone()._perp(); },
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Return a version of this point with the x & y coordinates
|
|
149
|
-
* rounded to integers.
|
|
150
|
-
* @return {Point} rounded point
|
|
151
|
-
*/
|
|
152
|
-
round: function() { return this.clone()._round(); },
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Return the magitude of this point: this is the Euclidean
|
|
156
|
-
* distance from the 0, 0 coordinate to this point's x and y
|
|
157
|
-
* coordinates.
|
|
158
|
-
* @return {Number} magnitude
|
|
159
|
-
*/
|
|
160
|
-
mag: function() {
|
|
161
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Judge whether this point is equal to another point, returning
|
|
166
|
-
* true or false.
|
|
167
|
-
* @param {Point} other the other point
|
|
168
|
-
* @return {boolean} whether the points are equal
|
|
169
|
-
*/
|
|
170
|
-
equals: function(other) {
|
|
171
|
-
return this.x === other.x &&
|
|
172
|
-
this.y === other.y;
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Calculate the distance from this point to another point
|
|
177
|
-
* @param {Point} p the other point
|
|
178
|
-
* @return {Number} distance
|
|
179
|
-
*/
|
|
180
|
-
dist: function(p) {
|
|
181
|
-
return Math.sqrt(this.distSqr(p));
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Calculate the distance from this point to another point,
|
|
186
|
-
* without the square root step. Useful if you're comparing
|
|
187
|
-
* relative distances.
|
|
188
|
-
* @param {Point} p the other point
|
|
189
|
-
* @return {Number} distance
|
|
190
|
-
*/
|
|
191
|
-
distSqr: function(p) {
|
|
192
|
-
var dx = p.x - this.x,
|
|
193
|
-
dy = p.y - this.y;
|
|
194
|
-
return dx * dx + dy * dy;
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Get the angle from the 0, 0 coordinate to this point, in radians
|
|
199
|
-
* coordinates.
|
|
200
|
-
* @return {Number} angle
|
|
201
|
-
*/
|
|
202
|
-
angle: function() {
|
|
203
|
-
return Math.atan2(this.y, this.x);
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Get the angle from this point to another point, in radians
|
|
208
|
-
* @param {Point} b the other point
|
|
209
|
-
* @return {Number} angle
|
|
210
|
-
*/
|
|
211
|
-
angleTo: function(b) {
|
|
212
|
-
return Math.atan2(this.y - b.y, this.x - b.x);
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Get the angle between this point and another point, in radians
|
|
217
|
-
* @param {Point} b the other point
|
|
218
|
-
* @return {Number} angle
|
|
219
|
-
*/
|
|
220
|
-
angleWith: function(b) {
|
|
221
|
-
return this.angleWithSep(b.x, b.y);
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
/*
|
|
225
|
-
* Find the angle of the two vectors, solving the formula for
|
|
226
|
-
* the cross product a x b = |a||b|sin(θ) for θ.
|
|
227
|
-
* @param {Number} x the x-coordinate
|
|
228
|
-
* @param {Number} y the y-coordinate
|
|
229
|
-
* @return {Number} the angle in radians
|
|
230
|
-
*/
|
|
231
|
-
angleWithSep: function(x, y) {
|
|
232
|
-
return Math.atan2(
|
|
233
|
-
this.x * y - this.y * x,
|
|
234
|
-
this.x * x + this.y * y);
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
_matMult: function(m) {
|
|
238
|
-
var x = m[0] * this.x + m[1] * this.y,
|
|
239
|
-
y = m[2] * this.x + m[3] * this.y;
|
|
240
|
-
this.x = x;
|
|
241
|
-
this.y = y;
|
|
242
|
-
return this;
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
_add: function(p) {
|
|
246
|
-
this.x += p.x;
|
|
247
|
-
this.y += p.y;
|
|
248
|
-
return this;
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
_sub: function(p) {
|
|
252
|
-
this.x -= p.x;
|
|
253
|
-
this.y -= p.y;
|
|
254
|
-
return this;
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
_mult: function(k) {
|
|
258
|
-
this.x *= k;
|
|
259
|
-
this.y *= k;
|
|
260
|
-
return this;
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
_div: function(k) {
|
|
264
|
-
this.x /= k;
|
|
265
|
-
this.y /= k;
|
|
266
|
-
return this;
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
_multByPoint: function(p) {
|
|
270
|
-
this.x *= p.x;
|
|
271
|
-
this.y *= p.y;
|
|
272
|
-
return this;
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
_divByPoint: function(p) {
|
|
276
|
-
this.x /= p.x;
|
|
277
|
-
this.y /= p.y;
|
|
278
|
-
return this;
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
_unit: function() {
|
|
282
|
-
this._div(this.mag());
|
|
283
|
-
return this;
|
|
284
|
-
},
|
|
285
|
-
|
|
286
|
-
_perp: function() {
|
|
287
|
-
var y = this.y;
|
|
288
|
-
this.y = this.x;
|
|
289
|
-
this.x = -y;
|
|
290
|
-
return this;
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
-
_rotate: function(angle) {
|
|
294
|
-
var cos = Math.cos(angle),
|
|
295
|
-
sin = Math.sin(angle),
|
|
296
|
-
x = cos * this.x - sin * this.y,
|
|
297
|
-
y = sin * this.x + cos * this.y;
|
|
298
|
-
this.x = x;
|
|
299
|
-
this.y = y;
|
|
300
|
-
return this;
|
|
301
|
-
},
|
|
302
|
-
|
|
303
|
-
_rotateAround: function(angle, p) {
|
|
304
|
-
var cos = Math.cos(angle),
|
|
305
|
-
sin = Math.sin(angle),
|
|
306
|
-
x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),
|
|
307
|
-
y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
|
|
308
|
-
this.x = x;
|
|
309
|
-
this.y = y;
|
|
310
|
-
return this;
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
_round: function() {
|
|
314
|
-
this.x = Math.round(this.x);
|
|
315
|
-
this.y = Math.round(this.y);
|
|
316
|
-
return this;
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Construct a point from an array if necessary, otherwise if the input
|
|
322
|
-
* is already a Point, or an unknown type, return it unchanged
|
|
323
|
-
* @param {Array<Number>|Point|*} a any kind of input value
|
|
324
|
-
* @return {Point} constructed point, or passed-through value.
|
|
325
|
-
* @example
|
|
326
|
-
* // this
|
|
327
|
-
* var point = Point.convert([0, 1]);
|
|
328
|
-
* // is equivalent to
|
|
329
|
-
* var point = new Point(0, 1);
|
|
330
|
-
*/
|
|
331
|
-
Point.convert = function (a) {
|
|
332
|
-
if (a instanceof Point) {
|
|
333
|
-
return a;
|
|
334
|
-
}
|
|
335
|
-
if (Array.isArray(a)) {
|
|
336
|
-
return new Point(a[0], a[1]);
|
|
337
|
-
}
|
|
338
|
-
return a;
|
|
339
|
-
};
|
|
340
|
-
return pointGeometry;
|
|
20
|
+
return _extends.apply(this, arguments);
|
|
341
21
|
}
|
|
342
22
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
347
|
-
|
|
348
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
349
|
-
var log = debug('pie-lib:graphing:tools:utils');
|
|
350
|
-
var FREQ_DIVIDER = 16;
|
|
351
|
-
var getAmplitudeAndFreq = (root, edge) => {
|
|
23
|
+
const log = debug('pie-lib:graphing:tools:utils');
|
|
24
|
+
const FREQ_DIVIDER = 16;
|
|
25
|
+
const getAmplitudeAndFreq = (root, edge) => {
|
|
352
26
|
if (!edge) {
|
|
353
27
|
return {
|
|
354
28
|
freq: 0,
|
|
@@ -363,9 +37,9 @@ var getAmplitudeAndFreq = (root, edge) => {
|
|
|
363
37
|
};
|
|
364
38
|
}
|
|
365
39
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
40
|
+
const r = new Point(root.x, root.y);
|
|
41
|
+
const e = new Point(edge.x, edge.y);
|
|
42
|
+
const d = e.sub(r); // edge point describes 1/4 of the freq
|
|
369
43
|
|
|
370
44
|
return {
|
|
371
45
|
freq: d.x * 4,
|
|
@@ -376,13 +50,13 @@ var getAmplitudeAndFreq = (root, edge) => {
|
|
|
376
50
|
* build the x points with root as the anchor.
|
|
377
51
|
*/
|
|
378
52
|
|
|
379
|
-
|
|
53
|
+
const xPoints = (root, freq, min, max) => {
|
|
380
54
|
freq = Math.abs(freq);
|
|
381
55
|
log('[xPoints] root:', root, 'freq:', freq, ' min:', min, ' max:', max);
|
|
382
56
|
|
|
383
|
-
|
|
57
|
+
const leftpoints = _.rangeRight(root, min - freq, freq * -1);
|
|
384
58
|
|
|
385
|
-
|
|
59
|
+
const rightpoints = _.range(root + freq, max + freq, freq);
|
|
386
60
|
|
|
387
61
|
return _.concat(leftpoints, rightpoints);
|
|
388
62
|
};
|
|
@@ -391,16 +65,16 @@ var xPoints = (root, freq, min, max) => {
|
|
|
391
65
|
* https://www.desmos.com/calculator/f1psfoiiv6
|
|
392
66
|
*/
|
|
393
67
|
|
|
394
|
-
|
|
395
|
-
shift =
|
|
68
|
+
const sinY = (amplitude, freq, shift) => x => {
|
|
69
|
+
shift = _extends({
|
|
396
70
|
phase: 0,
|
|
397
71
|
vertical: 0
|
|
398
72
|
}, shift);
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
73
|
+
const TWO_PI = Math.PI * 2;
|
|
74
|
+
const num = TWO_PI * (x - shift.phase);
|
|
75
|
+
const frac = num / freq;
|
|
76
|
+
const sin = Math.sin(frac);
|
|
77
|
+
const sinFloat = parseFloat(sin).toFixed(10);
|
|
404
78
|
return amplitude * sinFloat + shift.vertical;
|
|
405
79
|
};
|
|
406
80
|
/**
|
|
@@ -408,17 +82,17 @@ var sinY = (amplitude, freq, shift) => x => {
|
|
|
408
82
|
* https://www.desmos.com/calculator/xhz1xqgpca
|
|
409
83
|
*/
|
|
410
84
|
|
|
411
|
-
|
|
412
|
-
edge = edge ||
|
|
413
|
-
|
|
85
|
+
const parabolaFromTwoPoints = (root, edge) => {
|
|
86
|
+
edge = edge || _extends({}, root);
|
|
87
|
+
const mirrorEdge = {
|
|
414
88
|
x: root.x - (edge.x - root.x),
|
|
415
89
|
y: edge.y
|
|
416
90
|
};
|
|
417
91
|
return parabolaFromThreePoints(root, edge, mirrorEdge);
|
|
418
92
|
};
|
|
419
|
-
|
|
93
|
+
const parabolaFromThreePoints = (one, two, three) => {
|
|
420
94
|
log(one, two, three);
|
|
421
|
-
|
|
95
|
+
const {
|
|
422
96
|
a,
|
|
423
97
|
b,
|
|
424
98
|
c
|
|
@@ -428,19 +102,19 @@ var parabolaFromThreePoints = (one, two, three) => {
|
|
|
428
102
|
};
|
|
429
103
|
/** derive a,b,c from the 3 points */
|
|
430
104
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
105
|
+
const pointsToABC = (one, two, three) => {
|
|
106
|
+
const a1 = Math.pow(one.x, 2) * -1 + Math.pow(two.x, 2);
|
|
107
|
+
const b1 = one.x * -1 + two.x;
|
|
108
|
+
const d1 = one.y * -1 + two.y;
|
|
109
|
+
const a2 = Math.pow(two.x, 2) * -1 + Math.pow(three.x, 2);
|
|
110
|
+
const b2 = two.x * -1 + three.x;
|
|
111
|
+
const d2 = two.y * -1 + three.y;
|
|
112
|
+
const bMult = b2 / b1 * -1;
|
|
113
|
+
const a3 = bMult * a1 + a2;
|
|
114
|
+
const d3 = bMult * d1 + d2;
|
|
115
|
+
const a = d3 / a3;
|
|
116
|
+
const b = (d1 - a1 * a) / b1;
|
|
117
|
+
const c = one.y - a * Math.pow(one.x, 2) - b * one.x;
|
|
444
118
|
return {
|
|
445
119
|
a,
|
|
446
120
|
b,
|
|
@@ -451,7 +125,7 @@ var pointsToABC = (one, two, three) => {
|
|
|
451
125
|
* y=ax^2+bx+c
|
|
452
126
|
*/
|
|
453
127
|
|
|
454
|
-
|
|
128
|
+
const parabola = (a, b, c) => x => a * Math.pow(x, 2) + b * x + c;
|
|
455
129
|
/**
|
|
456
130
|
* Absolute value from two points Root (Vertex) the point where the two rays intersect and edge One point on a ray.
|
|
457
131
|
* @param root 1st point selected on graph
|
|
@@ -459,9 +133,9 @@ var parabola = (a, b, c) => x => a * Math.pow(x, 2) + b * x + c;
|
|
|
459
133
|
* https://www.desmos.com/calculator/rarxiatpip
|
|
460
134
|
*/
|
|
461
135
|
|
|
462
|
-
|
|
463
|
-
edge = edge ||
|
|
464
|
-
|
|
136
|
+
const absoluteFromTwoPoints = (root, edge) => {
|
|
137
|
+
edge = edge || _extends({}, root);
|
|
138
|
+
const a = pointsToAForAbsolute(root, edge);
|
|
465
139
|
return absolute(a, root.x, root.y);
|
|
466
140
|
};
|
|
467
141
|
/*
|
|
@@ -470,10 +144,10 @@ var absoluteFromTwoPoints = (root, edge) => {
|
|
|
470
144
|
* @param two 2nd point
|
|
471
145
|
* */
|
|
472
146
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
147
|
+
const pointsToAForAbsolute = (one, two) => {
|
|
148
|
+
const y1 = two.y - one.y;
|
|
149
|
+
const x1 = two.x - one.x;
|
|
150
|
+
let a = y1 / x1;
|
|
477
151
|
|
|
478
152
|
if (two.x < one.x) {
|
|
479
153
|
a = a * -1;
|
|
@@ -485,7 +159,7 @@ var pointsToAForAbsolute = (one, two) => {
|
|
|
485
159
|
* y=a*abs(x-h)+k
|
|
486
160
|
*/
|
|
487
161
|
|
|
488
|
-
|
|
162
|
+
const absolute = (a, h, k) => x => a * Math.abs(x - h) + k;
|
|
489
163
|
/**
|
|
490
164
|
* Exponential from two points on exponential graph.
|
|
491
165
|
* @param root 1st point selected on graph
|
|
@@ -493,9 +167,9 @@ var absolute = (a, h, k) => x => a * Math.abs(x - h) + k;
|
|
|
493
167
|
* https://www.desmos.com/calculator/3fisjexbvp
|
|
494
168
|
*/
|
|
495
169
|
|
|
496
|
-
|
|
497
|
-
edge = edge ||
|
|
498
|
-
|
|
170
|
+
const exponentialFromTwoPoints = (root, edge) => {
|
|
171
|
+
edge = edge || _extends({}, root);
|
|
172
|
+
const {
|
|
499
173
|
a,
|
|
500
174
|
b
|
|
501
175
|
} = pointsToABForExponential(root, edge);
|
|
@@ -507,11 +181,11 @@ var exponentialFromTwoPoints = (root, edge) => {
|
|
|
507
181
|
* @param two 2nd point
|
|
508
182
|
* */
|
|
509
183
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
184
|
+
const pointsToABForExponential = (one, two) => {
|
|
185
|
+
const p = one.y / two.y;
|
|
186
|
+
const r = 1 / (one.x - two.x);
|
|
187
|
+
const b = Math.pow(p, r);
|
|
188
|
+
const a = one.y / Math.pow(b, one.x);
|
|
515
189
|
return {
|
|
516
190
|
a,
|
|
517
191
|
b
|
|
@@ -521,7 +195,7 @@ var pointsToABForExponential = (one, two) => {
|
|
|
521
195
|
* y=a*(b)^x
|
|
522
196
|
*/
|
|
523
197
|
|
|
524
|
-
|
|
198
|
+
const exponential = (a, b) => x => a * Math.pow(b, x);
|
|
525
199
|
/**
|
|
526
200
|
* Generate a set of data points, add spacing before min and after max if there is space between minx + min and maxX and max
|
|
527
201
|
* @param {*} domain
|
|
@@ -532,34 +206,33 @@ var exponential = (a, b) => x => a * Math.pow(b, x);
|
|
|
532
206
|
* @param {*} excludeOutsidePoints
|
|
533
207
|
*/
|
|
534
208
|
|
|
535
|
-
|
|
536
|
-
var excludeOutsidePoints = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
209
|
+
const buildDataPoints = (domain, range, root, edge, yFn, excludeOutsidePoints = false) => {
|
|
537
210
|
log('[buildDataPoints] domain:', domain, 'range:', range, 'root:', root, 'edge:', edge);
|
|
538
|
-
domain =
|
|
211
|
+
domain = _extends({
|
|
539
212
|
min: 0,
|
|
540
213
|
max: 0,
|
|
541
214
|
step: 1
|
|
542
215
|
}, domain);
|
|
543
|
-
range =
|
|
216
|
+
range = _extends({
|
|
544
217
|
min: 0,
|
|
545
218
|
max: 0,
|
|
546
219
|
step: 1
|
|
547
220
|
}, range);
|
|
548
|
-
edge = edge ? edge :
|
|
549
|
-
|
|
550
|
-
|
|
221
|
+
edge = edge ? edge : _extends({}, root);
|
|
222
|
+
const minX = Math.min(root.x, edge.x);
|
|
223
|
+
const xPts = xPoints(minX, domain.step, domain.min - domain.step, domain.max + domain.step);
|
|
551
224
|
log('[buildDataPoints]:xPts:', xPts);
|
|
552
|
-
|
|
553
|
-
|
|
225
|
+
let startIndex = -1;
|
|
226
|
+
let endIndex = -1; // generate points based on the yFn
|
|
554
227
|
|
|
555
|
-
|
|
228
|
+
const points = xPts.map(v => new Point(v, yFn(v)));
|
|
556
229
|
|
|
557
230
|
if (!excludeOutsidePoints) {
|
|
558
231
|
return points;
|
|
559
232
|
} // exclude the points with y outside range min and max
|
|
560
233
|
|
|
561
234
|
|
|
562
|
-
|
|
235
|
+
const filteredPoints = points.reduce((acc, val, index) => {
|
|
563
236
|
if (val.y >= range.min - range.step && val.y <= range.max + range.step) {
|
|
564
237
|
if (startIndex === -1) {
|
|
565
238
|
startIndex = index;
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../node_modules/@mapbox/point-geometry/index.js","../src/index.js"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","'use strict';\n\nmodule.exports = Point;\n\n/**\n * A standalone point geometry with useful accessor, comparison, and\n * modification methods.\n *\n * @class Point\n * @param {Number} x the x-coordinate. this could be longitude or screen\n * pixels, or any other sort of unit.\n * @param {Number} y the y-coordinate. this could be latitude or screen\n * pixels, or any other sort of unit.\n * @example\n * var point = new Point(-77, 38);\n */\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n}\n\nPoint.prototype = {\n\n /**\n * Clone this point, returning a new point that can be modified\n * without affecting the old one.\n * @return {Point} the clone\n */\n clone: function() { return new Point(this.x, this.y); },\n\n /**\n * Add this point's x & y coordinates to another point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n add: function(p) { return this.clone()._add(p); },\n\n /**\n * Subtract this point's x & y coordinates to from point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n sub: function(p) { return this.clone()._sub(p); },\n\n /**\n * Multiply this point's x & y coordinates by point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n multByPoint: function(p) { return this.clone()._multByPoint(p); },\n\n /**\n * Divide this point's x & y coordinates by point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n divByPoint: function(p) { return this.clone()._divByPoint(p); },\n\n /**\n * Multiply this point's x & y coordinates by a factor,\n * yielding a new point.\n * @param {Point} k factor\n * @return {Point} output point\n */\n mult: function(k) { return this.clone()._mult(k); },\n\n /**\n * Divide this point's x & y coordinates by a factor,\n * yielding a new point.\n * @param {Point} k factor\n * @return {Point} output point\n */\n div: function(k) { return this.clone()._div(k); },\n\n /**\n * Rotate this point around the 0, 0 origin by an angle a,\n * given in radians\n * @param {Number} a angle to rotate around, in radians\n * @return {Point} output point\n */\n rotate: function(a) { return this.clone()._rotate(a); },\n\n /**\n * Rotate this point around p point by an angle a,\n * given in radians\n * @param {Number} a angle to rotate around, in radians\n * @param {Point} p Point to rotate around\n * @return {Point} output point\n */\n rotateAround: function(a,p) { return this.clone()._rotateAround(a,p); },\n\n /**\n * Multiply this point by a 4x1 transformation matrix\n * @param {Array<Number>} m transformation matrix\n * @return {Point} output point\n */\n matMult: function(m) { return this.clone()._matMult(m); },\n\n /**\n * Calculate this point but as a unit vector from 0, 0, meaning\n * that the distance from the resulting point to the 0, 0\n * coordinate will be equal to 1 and the angle from the resulting\n * point to the 0, 0 coordinate will be the same as before.\n * @return {Point} unit vector point\n */\n unit: function() { return this.clone()._unit(); },\n\n /**\n * Compute a perpendicular point, where the new y coordinate\n * is the old x coordinate and the new x coordinate is the old y\n * coordinate multiplied by -1\n * @return {Point} perpendicular point\n */\n perp: function() { return this.clone()._perp(); },\n\n /**\n * Return a version of this point with the x & y coordinates\n * rounded to integers.\n * @return {Point} rounded point\n */\n round: function() { return this.clone()._round(); },\n\n /**\n * Return the magitude of this point: this is the Euclidean\n * distance from the 0, 0 coordinate to this point's x and y\n * coordinates.\n * @return {Number} magnitude\n */\n mag: function() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n },\n\n /**\n * Judge whether this point is equal to another point, returning\n * true or false.\n * @param {Point} other the other point\n * @return {boolean} whether the points are equal\n */\n equals: function(other) {\n return this.x === other.x &&\n this.y === other.y;\n },\n\n /**\n * Calculate the distance from this point to another point\n * @param {Point} p the other point\n * @return {Number} distance\n */\n dist: function(p) {\n return Math.sqrt(this.distSqr(p));\n },\n\n /**\n * Calculate the distance from this point to another point,\n * without the square root step. Useful if you're comparing\n * relative distances.\n * @param {Point} p the other point\n * @return {Number} distance\n */\n distSqr: function(p) {\n var dx = p.x - this.x,\n dy = p.y - this.y;\n return dx * dx + dy * dy;\n },\n\n /**\n * Get the angle from the 0, 0 coordinate to this point, in radians\n * coordinates.\n * @return {Number} angle\n */\n angle: function() {\n return Math.atan2(this.y, this.x);\n },\n\n /**\n * Get the angle from this point to another point, in radians\n * @param {Point} b the other point\n * @return {Number} angle\n */\n angleTo: function(b) {\n return Math.atan2(this.y - b.y, this.x - b.x);\n },\n\n /**\n * Get the angle between this point and another point, in radians\n * @param {Point} b the other point\n * @return {Number} angle\n */\n angleWith: function(b) {\n return this.angleWithSep(b.x, b.y);\n },\n\n /*\n * Find the angle of the two vectors, solving the formula for\n * the cross product a x b = |a||b|sin(θ) for θ.\n * @param {Number} x the x-coordinate\n * @param {Number} y the y-coordinate\n * @return {Number} the angle in radians\n */\n angleWithSep: function(x, y) {\n return Math.atan2(\n this.x * y - this.y * x,\n this.x * x + this.y * y);\n },\n\n _matMult: function(m) {\n var x = m[0] * this.x + m[1] * this.y,\n y = m[2] * this.x + m[3] * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n\n _add: function(p) {\n this.x += p.x;\n this.y += p.y;\n return this;\n },\n\n _sub: function(p) {\n this.x -= p.x;\n this.y -= p.y;\n return this;\n },\n\n _mult: function(k) {\n this.x *= k;\n this.y *= k;\n return this;\n },\n\n _div: function(k) {\n this.x /= k;\n this.y /= k;\n return this;\n },\n\n _multByPoint: function(p) {\n this.x *= p.x;\n this.y *= p.y;\n return this;\n },\n\n _divByPoint: function(p) {\n this.x /= p.x;\n this.y /= p.y;\n return this;\n },\n\n _unit: function() {\n this._div(this.mag());\n return this;\n },\n\n _perp: function() {\n var y = this.y;\n this.y = this.x;\n this.x = -y;\n return this;\n },\n\n _rotate: function(angle) {\n var cos = Math.cos(angle),\n sin = Math.sin(angle),\n x = cos * this.x - sin * this.y,\n y = sin * this.x + cos * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n\n _rotateAround: function(angle, p) {\n var cos = Math.cos(angle),\n sin = Math.sin(angle),\n x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),\n y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);\n this.x = x;\n this.y = y;\n return this;\n },\n\n _round: function() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n }\n};\n\n/**\n * Construct a point from an array if necessary, otherwise if the input\n * is already a Point, or an unknown type, return it unchanged\n * @param {Array<Number>|Point|*} a any kind of input value\n * @return {Point} constructed point, or passed-through value.\n * @example\n * // this\n * var point = Point.convert([0, 1]);\n * // is equivalent to\n * var point = new Point(0, 1);\n */\nPoint.convert = function (a) {\n if (a instanceof Point) {\n return a;\n }\n if (Array.isArray(a)) {\n return new Point(a[0], a[1]);\n }\n return a;\n};\n","import debug from 'debug';\nimport Point from '@mapbox/point-geometry';\nimport _ from 'lodash';\nconst log = debug('pie-lib:graphing:tools:utils');\n\nexport const FREQ_DIVIDER = 16;\n\nexport const getAmplitudeAndFreq = (root, edge) => {\n if (!edge) {\n return { freq: 0, amplitude: 0 };\n }\n\n if (root.x == edge.x) {\n return { freq: 0, amplitude: 0 };\n }\n\n const r = new Point(root.x, root.y);\n const e = new Point(edge.x, edge.y);\n const d = e.sub(r);\n // edge point describes 1/4 of the freq\n return { freq: d.x * 4, amplitude: d.y };\n};\n\n/**\n * build the x points with root as the anchor.\n */\nexport const xPoints = (root, freq, min, max) => {\n freq = Math.abs(freq);\n log('[xPoints] root:', root, 'freq:', freq, ' min:', min, ' max:', max);\n const leftpoints = _.rangeRight(root, min - freq, freq * -1);\n const rightpoints = _.range(root + freq, max + freq, freq);\n\n return _.concat(leftpoints, rightpoints);\n};\n\n/**\n * Calculate y for x value using amp, freq and shift\n * https://www.desmos.com/calculator/f1psfoiiv6\n */\nexport const sinY = (amplitude, freq, shift) => (x) => {\n shift = { phase: 0, vertical: 0, ...shift };\n const TWO_PI = Math.PI * 2;\n const num = TWO_PI * (x - shift.phase);\n const frac = num / freq;\n const sin = Math.sin(frac);\n const sinFloat = parseFloat(sin).toFixed(10);\n return amplitude * sinFloat + shift.vertical;\n};\n\n/**\n * You need three points for the quadratic eq, so we mirror the edge point\n * https://www.desmos.com/calculator/xhz1xqgpca\n */\nexport const parabolaFromTwoPoints = (root, edge) => {\n edge = edge || { ...root };\n const mirrorEdge = { x: root.x - (edge.x - root.x), y: edge.y };\n return parabolaFromThreePoints(root, edge, mirrorEdge);\n};\n\nexport const parabolaFromThreePoints = (one, two, three) => {\n log(one, two, three);\n const { a, b, c } = pointsToABC(one, two, three);\n log(a, b, c);\n return parabola(a, b, c);\n};\n/** derive a,b,c from the 3 points */\nexport const pointsToABC = (one, two, three) => {\n const a1 = Math.pow(one.x, 2) * -1 + Math.pow(two.x, 2);\n const b1 = one.x * -1 + two.x;\n const d1 = one.y * -1 + two.y;\n const a2 = Math.pow(two.x, 2) * -1 + Math.pow(three.x, 2);\n const b2 = two.x * -1 + three.x;\n const d2 = two.y * -1 + three.y;\n const bMult = (b2 / b1) * -1;\n const a3 = bMult * a1 + a2;\n const d3 = bMult * d1 + d2;\n const a = d3 / a3;\n const b = (d1 - a1 * a) / b1;\n const c = one.y - a * Math.pow(one.x, 2) - b * one.x;\n return { a, b, c };\n};\n\n/**\n * y=ax^2+bx+c\n */\nexport const parabola = (a, b, c) => (x) => a * Math.pow(x, 2) + b * x + c;\n\n/**\n * Absolute value from two points Root (Vertex) the point where the two rays intersect and edge One point on a ray.\n * @param root 1st point selected on graph\n * @param edge 2nd point selected on graph\n * https://www.desmos.com/calculator/rarxiatpip\n */\nexport const absoluteFromTwoPoints = (root, edge) => {\n edge = edge || { ...root };\n const a = pointsToAForAbsolute(root, edge);\n return absolute(a, root.x, root.y);\n};\n\n/*\n * Finds value of a in y=a*abs(x-h)+k function\n * @param one 1st point\n * @param two 2nd point\n * */\nexport const pointsToAForAbsolute = (one, two) => {\n const y1 = two.y - one.y;\n const x1 = two.x - one.x;\n let a = y1 / x1;\n if (two.x < one.x) {\n a = a * -1;\n }\n return a;\n};\n\n/**\n * y=a*abs(x-h)+k\n */\nexport const absolute = (a, h, k) => (x) => a * Math.abs(x - h) + k;\n\n/**\n * Exponential from two points on exponential graph.\n * @param root 1st point selected on graph\n * @param edge 2nd point selected on graph\n * https://www.desmos.com/calculator/3fisjexbvp\n */\nexport const exponentialFromTwoPoints = (root, edge) => {\n edge = edge || { ...root };\n const { a, b } = pointsToABForExponential(root, edge);\n return exponential(a, b);\n};\n\n/*\n * Finds value of a and b in y=a*(b)^x function\n * @param one 1st point\n * @param two 2nd point\n * */\nexport const pointsToABForExponential = (one, two) => {\n const p = one.y / two.y;\n const r = 1 / (one.x - two.x);\n const b = Math.pow(p, r);\n const a = one.y / Math.pow(b, one.x);\n return { a, b };\n};\n\n/**\n * y=a*(b)^x\n */\nexport const exponential = (a, b) => (x) => a * Math.pow(b, x);\n\n/**\n * Generate a set of data points, add spacing before min and after max if there is space between minx + min and maxX and max\n * @param {*} domain\n * @param {*} range\n * @param {*} root\n * @param {*} edge\n * @param {*} yFn\n * @param {*} excludeOutsidePoints\n */\nexport const buildDataPoints = (domain, range, root, edge, yFn, excludeOutsidePoints = false) => {\n log('[buildDataPoints] domain:', domain, 'range:', range, 'root:', root, 'edge:', edge);\n\n domain = { min: 0, max: 0, step: 1, ...domain };\n range = { min: 0, max: 0, step: 1, ...range };\n edge = edge ? edge : { ...root };\n\n const minX = Math.min(root.x, edge.x);\n const xPts = xPoints(minX, domain.step, domain.min - domain.step, domain.max + domain.step);\n\n log('[buildDataPoints]:xPts:', xPts);\n\n let startIndex = -1;\n let endIndex = -1;\n\n // generate points based on the yFn\n const points = xPts.map((v) => new Point(v, yFn(v)));\n\n if (!excludeOutsidePoints) {\n return points;\n }\n\n // exclude the points with y outside range min and max\n const filteredPoints = points.reduce((acc, val, index) => {\n if (val.y >= range.min - range.step && val.y <= range.max + range.step) {\n if (startIndex === -1) {\n startIndex = index;\n }\n\n if (endIndex < index) {\n endIndex = index;\n }\n\n return [...acc, val];\n }\n\n return acc;\n }, []);\n\n // add the first value outside range min and max smaller than range.min if exists\n if (startIndex - 1 >= 0) {\n filteredPoints.unshift(points[startIndex - 1]);\n }\n\n // add the first value outside range min and max greater than range.min if exists\n if (endIndex + 1 <= points.length - 1) {\n filteredPoints.push(points[endIndex + 1]);\n }\n\n return points;\n};\n\nexport default {\n FREQ_DIVIDER,\n getAmplitudeAndFreq,\n xPoints,\n sinY,\n parabolaFromTwoPoints,\n parabolaFromThreePoints,\n pointsToABC,\n parabola,\n absoluteFromTwoPoints,\n pointsToAForAbsolute,\n absolute,\n exponentialFromTwoPoints,\n pointsToABForExponential,\n exponential,\n buildDataPoints,\n};\n"],"names":["log","debug","FREQ_DIVIDER","getAmplitudeAndFreq","root","edge","freq","amplitude","x","r","Point","y","e","d","sub","xPoints","min","max","Math","abs","leftpoints","_","rangeRight","rightpoints","range","concat","sinY","shift","phase","vertical","TWO_PI","PI","num","frac","sin","sinFloat","parseFloat","toFixed","parabolaFromTwoPoints","mirrorEdge","parabolaFromThreePoints","one","two","three","a","b","c","pointsToABC","parabola","a1","pow","b1","d1","a2","b2","d2","bMult","a3","d3","absoluteFromTwoPoints","pointsToAForAbsolute","absolute","y1","x1","h","k","exponentialFromTwoPoints","pointsToABForExponential","exponential","p","buildDataPoints","domain","yFn","excludeOutsidePoints","step","minX","xPts","startIndex","endIndex","points","map","v","filteredPoints","reduce","acc","val","index","unshift","length","push"],"mappings":";;;AAAe,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;AACzD,EAAE,IAAI,GAAG,IAAI,G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AVa;AAWbC,EAAAA,QAXa;AAYbK,EAAAA,wBAZa;AAabC,EAAAA,wBAba;AAcbC,EAAAA,WAda;AAebE,EAAAA;AAfa,CAAf;;;;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.js"],"sourcesContent":["import debug from 'debug';\nimport Point from '@mapbox/point-geometry';\nimport _ from 'lodash';\nconst log = debug('pie-lib:graphing:tools:utils');\n\nexport const FREQ_DIVIDER = 16;\n\nexport const getAmplitudeAndFreq = (root, edge) => {\n if (!edge) {\n return { freq: 0, amplitude: 0 };\n }\n\n if (root.x == edge.x) {\n return { freq: 0, amplitude: 0 };\n }\n\n const r = new Point(root.x, root.y);\n const e = new Point(edge.x, edge.y);\n const d = e.sub(r);\n // edge point describes 1/4 of the freq\n return { freq: d.x * 4, amplitude: d.y };\n};\n\n/**\n * build the x points with root as the anchor.\n */\nexport const xPoints = (root, freq, min, max) => {\n freq = Math.abs(freq);\n log('[xPoints] root:', root, 'freq:', freq, ' min:', min, ' max:', max);\n const leftpoints = _.rangeRight(root, min - freq, freq * -1);\n const rightpoints = _.range(root + freq, max + freq, freq);\n\n return _.concat(leftpoints, rightpoints);\n};\n\n/**\n * Calculate y for x value using amp, freq and shift\n * https://www.desmos.com/calculator/f1psfoiiv6\n */\nexport const sinY = (amplitude, freq, shift) => (x) => {\n shift = { phase: 0, vertical: 0, ...shift };\n const TWO_PI = Math.PI * 2;\n const num = TWO_PI * (x - shift.phase);\n const frac = num / freq;\n const sin = Math.sin(frac);\n const sinFloat = parseFloat(sin).toFixed(10);\n return amplitude * sinFloat + shift.vertical;\n};\n\n/**\n * You need three points for the quadratic eq, so we mirror the edge point\n * https://www.desmos.com/calculator/xhz1xqgpca\n */\nexport const parabolaFromTwoPoints = (root, edge) => {\n edge = edge || { ...root };\n const mirrorEdge = { x: root.x - (edge.x - root.x), y: edge.y };\n return parabolaFromThreePoints(root, edge, mirrorEdge);\n};\n\nexport const parabolaFromThreePoints = (one, two, three) => {\n log(one, two, three);\n const { a, b, c } = pointsToABC(one, two, three);\n log(a, b, c);\n return parabola(a, b, c);\n};\n/** derive a,b,c from the 3 points */\nexport const pointsToABC = (one, two, three) => {\n const a1 = Math.pow(one.x, 2) * -1 + Math.pow(two.x, 2);\n const b1 = one.x * -1 + two.x;\n const d1 = one.y * -1 + two.y;\n const a2 = Math.pow(two.x, 2) * -1 + Math.pow(three.x, 2);\n const b2 = two.x * -1 + three.x;\n const d2 = two.y * -1 + three.y;\n const bMult = (b2 / b1) * -1;\n const a3 = bMult * a1 + a2;\n const d3 = bMult * d1 + d2;\n const a = d3 / a3;\n const b = (d1 - a1 * a) / b1;\n const c = one.y - a * Math.pow(one.x, 2) - b * one.x;\n return { a, b, c };\n};\n\n/**\n * y=ax^2+bx+c\n */\nexport const parabola = (a, b, c) => (x) => a * Math.pow(x, 2) + b * x + c;\n\n/**\n * Absolute value from two points Root (Vertex) the point where the two rays intersect and edge One point on a ray.\n * @param root 1st point selected on graph\n * @param edge 2nd point selected on graph\n * https://www.desmos.com/calculator/rarxiatpip\n */\nexport const absoluteFromTwoPoints = (root, edge) => {\n edge = edge || { ...root };\n const a = pointsToAForAbsolute(root, edge);\n return absolute(a, root.x, root.y);\n};\n\n/*\n * Finds value of a in y=a*abs(x-h)+k function\n * @param one 1st point\n * @param two 2nd point\n * */\nexport const pointsToAForAbsolute = (one, two) => {\n const y1 = two.y - one.y;\n const x1 = two.x - one.x;\n let a = y1 / x1;\n if (two.x < one.x) {\n a = a * -1;\n }\n return a;\n};\n\n/**\n * y=a*abs(x-h)+k\n */\nexport const absolute = (a, h, k) => (x) => a * Math.abs(x - h) + k;\n\n/**\n * Exponential from two points on exponential graph.\n * @param root 1st point selected on graph\n * @param edge 2nd point selected on graph\n * https://www.desmos.com/calculator/3fisjexbvp\n */\nexport const exponentialFromTwoPoints = (root, edge) => {\n edge = edge || { ...root };\n const { a, b } = pointsToABForExponential(root, edge);\n return exponential(a, b);\n};\n\n/*\n * Finds value of a and b in y=a*(b)^x function\n * @param one 1st point\n * @param two 2nd point\n * */\nexport const pointsToABForExponential = (one, two) => {\n const p = one.y / two.y;\n const r = 1 / (one.x - two.x);\n const b = Math.pow(p, r);\n const a = one.y / Math.pow(b, one.x);\n return { a, b };\n};\n\n/**\n * y=a*(b)^x\n */\nexport const exponential = (a, b) => (x) => a * Math.pow(b, x);\n\n/**\n * Generate a set of data points, add spacing before min and after max if there is space between minx + min and maxX and max\n * @param {*} domain\n * @param {*} range\n * @param {*} root\n * @param {*} edge\n * @param {*} yFn\n * @param {*} excludeOutsidePoints\n */\nexport const buildDataPoints = (domain, range, root, edge, yFn, excludeOutsidePoints = false) => {\n log('[buildDataPoints] domain:', domain, 'range:', range, 'root:', root, 'edge:', edge);\n\n domain = { min: 0, max: 0, step: 1, ...domain };\n range = { min: 0, max: 0, step: 1, ...range };\n edge = edge ? edge : { ...root };\n\n const minX = Math.min(root.x, edge.x);\n const xPts = xPoints(minX, domain.step, domain.min - domain.step, domain.max + domain.step);\n\n log('[buildDataPoints]:xPts:', xPts);\n\n let startIndex = -1;\n let endIndex = -1;\n\n // generate points based on the yFn\n const points = xPts.map((v) => new Point(v, yFn(v)));\n\n if (!excludeOutsidePoints) {\n return points;\n }\n\n // exclude the points with y outside range min and max\n const filteredPoints = points.reduce((acc, val, index) => {\n if (val.y >= range.min - range.step && val.y <= range.max + range.step) {\n if (startIndex === -1) {\n startIndex = index;\n }\n\n if (endIndex < index) {\n endIndex = index;\n }\n\n return [...acc, val];\n }\n\n return acc;\n }, []);\n\n // add the first value outside range min and max smaller than range.min if exists\n if (startIndex - 1 >= 0) {\n filteredPoints.unshift(points[startIndex - 1]);\n }\n\n // add the first value outside range min and max greater than range.min if exists\n if (endIndex + 1 <= points.length - 1) {\n filteredPoints.push(points[endIndex + 1]);\n }\n\n return points;\n};\n\nexport default {\n FREQ_DIVIDER,\n getAmplitudeAndFreq,\n xPoints,\n sinY,\n parabolaFromTwoPoints,\n parabolaFromThreePoints,\n pointsToABC,\n parabola,\n absoluteFromTwoPoints,\n pointsToAForAbsolute,\n absolute,\n exponentialFromTwoPoints,\n pointsToABForExponential,\n exponential,\n buildDataPoints,\n};\n"],"names":["log","debug","FREQ_DIVIDER","getAmplitudeAndFreq","root","edge","freq","amplitude","x","r","Point","y","e","d","sub","xPoints","min","max","Math","abs","leftpoints","_","rangeRight","rightpoints","range","concat","sinY","shift","phase","vertical","TWO_PI","PI","num","frac","sin","sinFloat","parseFloat","toFixed","parabolaFromTwoPoints","mirrorEdge","parabolaFromThreePoints","one","two","three","a","b","c","pointsToABC","parabola","a1","pow","b1","d1","a2","b2","d2","bMult","a3","d3","absoluteFromTwoPoints","pointsToAForAbsolute","absolute","y1","x1","h","k","exponentialFromTwoPoints","pointsToABForExponential","exponential","p","buildDataPoints","domain","yFn","excludeOutsidePoints","step","minX","xPts","startIndex","endIndex","points","map","v","filteredPoints","reduce","acc","val","index","unshift","length","push"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,GAAG,GAAGC,KAAK,CAAC,8BAAD,CAAjB;AAEO,MAAMC,YAAY,GAAG;MAEfC,mBAAmB,GAAG,CAACC,IAAD,EAAOC,IAAP,KAAgB;AACjD,EAAA,IAAI,CAACA,IAAL,EAAW;AACT,IAAA,OAAO;AAAEC,MAAAA,IAAI,EAAE,CAAR;AAAWC,MAAAA,SAAS,EAAE;AAAtB,KAAP;AACD,EAAA;;AAED,EAAA,IAAIH,IAAI,CAACI,CAAL,IAAUH,IAAI,CAACG,CAAnB,EAAsB;AACpB,IAAA,OAAO;AAAEF,MAAAA,IAAI,EAAE,CAAR;AAAWC,MAAAA,SAAS,EAAE;AAAtB,KAAP;AACD,EAAA;;AAED,EAAA,MAAME,CAAC,GAAG,IAAIC,KAAJ,CAAUN,IAAI,CAACI,CAAf,EAAkBJ,IAAI,CAACO,CAAvB,CAAV;AACA,EAAA,MAAMC,CAAC,GAAG,IAAIF,KAAJ,CAAUL,IAAI,CAACG,CAAf,EA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,IAJa;AAKbY,EAAAA,qBALa;AAMbE,EAAAA,uBANa;AAObO,EAAAA,WAPa;AAQbC,EAAAA,QARa;AASbW,EAAAA,qBATa;AAUbC,EAAAA,oBAVa;AAWbC,EAAAA,QAXa;AAYbK,EAAAA,wBAZa;AAabC,EAAAA,wBAba;AAcbC,EAAAA,WAda;AAebE,EAAAA;AAfa,CAAf;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/graphing-utils",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"debug": "^4.1.1",
|
|
15
15
|
"lodash": "^4.17.11"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "3b10dbe1c14708ccf9a9e8af8f1eafec6ed7dd2d",
|
|
18
18
|
"scripts": {},
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|