@rian8337/osu-base 2.1.0-beta.0 → 2.1.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +731 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/typings/index.d.ts +283 -5
package/dist/index.js
CHANGED
|
@@ -1613,7 +1613,7 @@ class BeatmapHitObjects {
|
|
|
1613
1613
|
findInsertionIndex(startTime) {
|
|
1614
1614
|
for (let i = 0; i < this.objects.length; ++i) {
|
|
1615
1615
|
if (this.objects[i].startTime > startTime) {
|
|
1616
|
-
return i
|
|
1616
|
+
return i;
|
|
1617
1617
|
}
|
|
1618
1618
|
}
|
|
1619
1619
|
return this.objects.length;
|
|
@@ -2376,9 +2376,8 @@ class ModUtil {
|
|
|
2376
2376
|
/**
|
|
2377
2377
|
* Checks for mods that are incompatible with each other.
|
|
2378
2378
|
*
|
|
2379
|
-
* This will modify the original array.
|
|
2380
|
-
*
|
|
2381
2379
|
* @param mods The mods to check for.
|
|
2380
|
+
* @returns Mods that have been filtered.
|
|
2382
2381
|
*/
|
|
2383
2382
|
static checkIncompatibleMods(mods) {
|
|
2384
2383
|
for (const incompatibleMod of this.incompatibleMods) {
|
|
@@ -2391,6 +2390,7 @@ class ModUtil {
|
|
|
2391
2390
|
mods.push(fulfilledMods[0]);
|
|
2392
2391
|
}
|
|
2393
2392
|
}
|
|
2393
|
+
return mods;
|
|
2394
2394
|
}
|
|
2395
2395
|
/**
|
|
2396
2396
|
* Processes parsing options.
|
|
@@ -2404,7 +2404,7 @@ class ModUtil {
|
|
|
2404
2404
|
mods = this.checkDuplicateMods(mods);
|
|
2405
2405
|
}
|
|
2406
2406
|
if (options?.checkIncompatible !== false) {
|
|
2407
|
-
this.checkIncompatibleMods(mods);
|
|
2407
|
+
mods = this.checkIncompatibleMods(mods);
|
|
2408
2408
|
}
|
|
2409
2409
|
return mods;
|
|
2410
2410
|
}
|
|
@@ -2593,8 +2593,6 @@ class MapStats {
|
|
|
2593
2593
|
this.od = MapStats.modifyOD(this.od, this.speedMultiplier, statisticsMultiplier);
|
|
2594
2594
|
}
|
|
2595
2595
|
break;
|
|
2596
|
-
default:
|
|
2597
|
-
throw new TypeError("Mode not supported");
|
|
2598
2596
|
}
|
|
2599
2597
|
return this;
|
|
2600
2598
|
}
|
|
@@ -2788,9 +2786,7 @@ class PathApproximator {
|
|
|
2788
2786
|
for (let i = 0; i < controlPoints.length - 1; ++i) {
|
|
2789
2787
|
const v1 = i > 0 ? controlPoints[i - 1] : controlPoints[i];
|
|
2790
2788
|
const v2 = controlPoints[i];
|
|
2791
|
-
const v3 = i
|
|
2792
|
-
? controlPoints[i + 1]
|
|
2793
|
-
: v2.add(v2).subtract(v1);
|
|
2789
|
+
const v3 = controlPoints[i + 1];
|
|
2794
2790
|
const v4 = i < controlPoints.length - 2
|
|
2795
2791
|
? controlPoints[i + 2]
|
|
2796
2792
|
: v3.add(v3).subtract(v2);
|
|
@@ -2815,7 +2811,7 @@ class PathApproximator {
|
|
|
2815
2811
|
// If we have a degenerate triangle where a side-length is almost zero, then give up and fall
|
|
2816
2812
|
// back to a more numerically stable method.
|
|
2817
2813
|
if (Precision.almostEqualsNumber(0, (b.y - a.y) * (c.x - a.x) - (b.x - a.x) * (c.y - a.y))) {
|
|
2818
|
-
return
|
|
2814
|
+
return this.approximateBezier(controlPoints);
|
|
2819
2815
|
}
|
|
2820
2816
|
// See: https://en.wikipedia.org/wiki/Circumscribed_circle#Cartesian_coordinates_2
|
|
2821
2817
|
const d = 2 *
|
|
@@ -3053,17 +3049,11 @@ class SliderPath {
|
|
|
3053
3049
|
switch (this.pathType) {
|
|
3054
3050
|
case exports.PathType.Linear:
|
|
3055
3051
|
return PathApproximator.approximateLinear(subControlPoints);
|
|
3056
|
-
case exports.PathType.PerfectCurve:
|
|
3052
|
+
case exports.PathType.PerfectCurve:
|
|
3057
3053
|
if (subControlPoints.length !== 3) {
|
|
3058
3054
|
break;
|
|
3059
3055
|
}
|
|
3060
|
-
|
|
3061
|
-
// If for some reason a circular arc could not be fit to the 3 given points, fall back to a numerically stable bezier approximation.
|
|
3062
|
-
if (subPath.length === 0) {
|
|
3063
|
-
break;
|
|
3064
|
-
}
|
|
3065
|
-
return subPath;
|
|
3066
|
-
}
|
|
3056
|
+
return PathApproximator.approximateCircularArc(subControlPoints);
|
|
3067
3057
|
case exports.PathType.Catmull:
|
|
3068
3058
|
return PathApproximator.approximateCatmull(subControlPoints);
|
|
3069
3059
|
}
|
|
@@ -4046,6 +4036,8 @@ class BeatmapEventsDecoder extends SectionDecoder {
|
|
|
4046
4036
|
case "Break":
|
|
4047
4037
|
this.parseBreak(s);
|
|
4048
4038
|
break;
|
|
4039
|
+
default:
|
|
4040
|
+
this.storyboardLines.push(line);
|
|
4049
4041
|
}
|
|
4050
4042
|
}
|
|
4051
4043
|
parseBackground(s) {
|
|
@@ -4798,9 +4790,6 @@ class StoryboardSprite extends StoryboardElement {
|
|
|
4798
4790
|
earliestStartTime = Math.min(earliestStartTime, l.loopStartTime + loopEarliestDisplayTime);
|
|
4799
4791
|
}
|
|
4800
4792
|
}
|
|
4801
|
-
if (earliestStartTime !== Number.POSITIVE_INFINITY) {
|
|
4802
|
-
return earliestStartTime;
|
|
4803
|
-
}
|
|
4804
4793
|
return earliestStartTime !== Number.POSITIVE_INFINITY
|
|
4805
4794
|
? earliestStartTime
|
|
4806
4795
|
: Math.min(this.timelineGroup.startTime, ...this._loops.map((l) => l.startTime));
|
|
@@ -5231,7 +5220,7 @@ class Storyboard {
|
|
|
5231
5220
|
layer = new StoryboardLayer(type, --this.minimumLayerDepth);
|
|
5232
5221
|
this.layers[type] = layer;
|
|
5233
5222
|
}
|
|
5234
|
-
return layer;
|
|
5223
|
+
return layer ?? null;
|
|
5235
5224
|
}
|
|
5236
5225
|
}
|
|
5237
5226
|
|
|
@@ -6097,6 +6086,724 @@ exports.Easing = void 0;
|
|
|
6097
6086
|
Easing[Easing["outPow10"] = 35] = "outPow10";
|
|
6098
6087
|
})(exports.Easing || (exports.Easing = {}));
|
|
6099
6088
|
|
|
6089
|
+
/**
|
|
6090
|
+
* A single-variable polynomial with real-valued coefficients and non-negative exponents.
|
|
6091
|
+
*
|
|
6092
|
+
* This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
|
|
6093
|
+
*/
|
|
6094
|
+
class Polynomial {
|
|
6095
|
+
/**
|
|
6096
|
+
* Evaluates a polynomial at point z.
|
|
6097
|
+
*
|
|
6098
|
+
* Coefficients are ordered ascending by power with power k at index k.
|
|
6099
|
+
* For example, coefficients `[3, -1, 2]` represent `y = 2x^2 - x + 3`.
|
|
6100
|
+
*
|
|
6101
|
+
* @param z The location where to evaluate the polynomial at.
|
|
6102
|
+
* @param coefficients The coefficients of the polynomial, coefficient for power k at index k.
|
|
6103
|
+
* @returns The polynomial at z.
|
|
6104
|
+
*/
|
|
6105
|
+
static evaluate(z, coefficients) {
|
|
6106
|
+
// Zero polynomials need explicit handling, otherwise we
|
|
6107
|
+
// will attempt to peek coefficients at negative indices.
|
|
6108
|
+
if (coefficients.length === 0) {
|
|
6109
|
+
return 0;
|
|
6110
|
+
}
|
|
6111
|
+
let sum = coefficients.at(-1);
|
|
6112
|
+
for (let i = coefficients.length - 2; i >= 0; --i) {
|
|
6113
|
+
sum *= z;
|
|
6114
|
+
sum += coefficients[i];
|
|
6115
|
+
}
|
|
6116
|
+
return sum;
|
|
6117
|
+
}
|
|
6118
|
+
}
|
|
6119
|
+
|
|
6120
|
+
/**
|
|
6121
|
+
* A Math utility class containing all methods related to the error function.
|
|
6122
|
+
*
|
|
6123
|
+
* This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
|
|
6124
|
+
*/
|
|
6125
|
+
class ErrorFunction {
|
|
6126
|
+
//#region Coefficients for erfImp
|
|
6127
|
+
/**
|
|
6128
|
+
* Polynomial coefficients for a numerator of erfImp
|
|
6129
|
+
* calculation for erf(x) in the interval [1e-10, 0.5].
|
|
6130
|
+
*/
|
|
6131
|
+
static erfImpAn = [
|
|
6132
|
+
0.003379167095512574, -0.0007369565304816795, -0.37473233739291961,
|
|
6133
|
+
0.0817442448733587, -0.04210893199365486, 0.007016570951209576,
|
|
6134
|
+
-0.004950912559824351, 0.0008716465990379225,
|
|
6135
|
+
];
|
|
6136
|
+
/**
|
|
6137
|
+
* Polynomial coefficients for a denominator of erfImp
|
|
6138
|
+
* calculation for erf(x) in the interval [1e-10, 0.5].
|
|
6139
|
+
*/
|
|
6140
|
+
static erfImpAd = [
|
|
6141
|
+
1, -0.2180882180879246, 0.4125429727254421, -0.08418911478731068,
|
|
6142
|
+
0.0655338856400242, -0.01200196044549418, 0.00408165558926174,
|
|
6143
|
+
-0.0006159007215577697,
|
|
6144
|
+
];
|
|
6145
|
+
/**
|
|
6146
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6147
|
+
* calculationfor erfc(x) in the interval [0.5, 0.75].
|
|
6148
|
+
*/
|
|
6149
|
+
static erfImpBn = [
|
|
6150
|
+
-0.03617903907182625, 0.29225188344488268, 0.2814470417976045,
|
|
6151
|
+
0.12561020886276694, 0.02741350282689305, 0.002508396721680658,
|
|
6152
|
+
];
|
|
6153
|
+
/**
|
|
6154
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6155
|
+
* calculation for Erfc(x) in the interval [0.5, 0.75].
|
|
6156
|
+
*/
|
|
6157
|
+
static erfImpBd = [
|
|
6158
|
+
1, 1.8545005897903486, 1.43575803037831418, 0.58282765875303655,
|
|
6159
|
+
0.1248104769329497, 0.011372417654635328,
|
|
6160
|
+
];
|
|
6161
|
+
/**
|
|
6162
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6163
|
+
* calculation for erfc(x) in the interval [0.75, 1.25].
|
|
6164
|
+
*/
|
|
6165
|
+
static erfImpCn = [
|
|
6166
|
+
-0.03978768926111369, 0.15316521246787829, 0.19126029560093624,
|
|
6167
|
+
0.10276327061989304, 0.029637090615738836, 0.004609348678027549,
|
|
6168
|
+
0.0003076078203486802,
|
|
6169
|
+
];
|
|
6170
|
+
/**
|
|
6171
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6172
|
+
* calculation for erfc(x) in the interval [0.75, 1.25].
|
|
6173
|
+
*/
|
|
6174
|
+
static erfImpCd = [
|
|
6175
|
+
1, 1.955200729876277, 1.6476231719938486, 0.7682386070221263,
|
|
6176
|
+
0.20979318593650978, 0.03195693168999134, 0.0021336316089578537,
|
|
6177
|
+
];
|
|
6178
|
+
/**
|
|
6179
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6180
|
+
* calculation for erfc(x) in the interval [1.25, 2.25].
|
|
6181
|
+
*/
|
|
6182
|
+
static erfImpDn = [
|
|
6183
|
+
-0.030083856055794972, 0.05385788298444545, 0.07262115416519142,
|
|
6184
|
+
0.03676284698880493, 0.009646290155725275, 0.0013345348007529107,
|
|
6185
|
+
0.778087599782504e-4,
|
|
6186
|
+
];
|
|
6187
|
+
/**
|
|
6188
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6189
|
+
* calculation for erfc(x) in the interval [1.25, 2.25].
|
|
6190
|
+
*/
|
|
6191
|
+
static erfImpDd = [
|
|
6192
|
+
1, 1.7596709814716753, 1.3288357143796112, 0.5525285965087576,
|
|
6193
|
+
0.1337930569413329, 0.017950964517628076, 0.001047124400199374,
|
|
6194
|
+
-0.10664038182035734e-7,
|
|
6195
|
+
];
|
|
6196
|
+
/**
|
|
6197
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6198
|
+
* calculation for erfc(x) in the interval [2.25, 3.5].
|
|
6199
|
+
*/
|
|
6200
|
+
static erfImpEn = [
|
|
6201
|
+
-0.011790757013722784, 0.01426213209053881, 0.02022344359029608,
|
|
6202
|
+
0.00930668299990432, 0.0021335780242206599, 0.000250229873864601,
|
|
6203
|
+
0.1205349122195882e-4,
|
|
6204
|
+
];
|
|
6205
|
+
/**
|
|
6206
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6207
|
+
* calculation for erfc(x) in the interval [2.25, 3.5].
|
|
6208
|
+
*/
|
|
6209
|
+
static erfImpEd = [
|
|
6210
|
+
1, 1.5037622520362048, 0.9653977862044629, 0.3392652304767967,
|
|
6211
|
+
0.068974064954157, 0.0077106026249176831, 0.0003714211015310693,
|
|
6212
|
+
];
|
|
6213
|
+
/**
|
|
6214
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6215
|
+
* calculation for erfc(x) in the interval [3.5, 5.25].
|
|
6216
|
+
*/
|
|
6217
|
+
static erfImpFn = [
|
|
6218
|
+
-0.005469547955387293, 0.004041902787317071, 0.0054963369553161171,
|
|
6219
|
+
0.002126164726039454, 0.0003949840144950839, 0.36556547706444238e-4,
|
|
6220
|
+
0.13548589710993232e-5,
|
|
6221
|
+
];
|
|
6222
|
+
/**
|
|
6223
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6224
|
+
* calculation for erfc(x) in the interval [3.5, 5.25].
|
|
6225
|
+
*/
|
|
6226
|
+
static erfImpFd = [
|
|
6227
|
+
1, 1.210196977736308, 0.6209146682211439, 0.1730384306611428,
|
|
6228
|
+
0.0276550813773432, 0.002406259744243097, 0.8918118172513366e-4,
|
|
6229
|
+
-0.4655288362833827e-11,
|
|
6230
|
+
];
|
|
6231
|
+
/**
|
|
6232
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6233
|
+
* calculation for erfc(x) in the interval [5.25, 8].
|
|
6234
|
+
*/
|
|
6235
|
+
static erfImpGn = [
|
|
6236
|
+
-0.002707225359057783, 0.00131875634250294, 0.0011992593326100233,
|
|
6237
|
+
0.00027849619811344664, 0.2678229882183318e-4, 0.9230436723150282e-6,
|
|
6238
|
+
];
|
|
6239
|
+
/**
|
|
6240
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6241
|
+
* calculation for erfc(x) in the interval [5.25, 8].
|
|
6242
|
+
*/
|
|
6243
|
+
static erfImpGd = [
|
|
6244
|
+
1, 0.8146328085431416, 0.26890166585629954, 0.04498772161030411,
|
|
6245
|
+
0.003817596633202485, 0.0001315718978885969, 0.4048153596757641e-11,
|
|
6246
|
+
];
|
|
6247
|
+
/**
|
|
6248
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6249
|
+
* calculation for erfc(x) in the interval [8, 11.5].
|
|
6250
|
+
*/
|
|
6251
|
+
static erfImpHn = [
|
|
6252
|
+
-0.001099467206917422, 0.00040642544275042267, 0.0002744994894169007,
|
|
6253
|
+
0.4652937706466594e-4, 0.320955425395767463e-5, 0.778286018145021e-7,
|
|
6254
|
+
];
|
|
6255
|
+
/**
|
|
6256
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6257
|
+
* calculation for erfc(x) in the interval [8, 11.5].
|
|
6258
|
+
*/
|
|
6259
|
+
static erfImpHd = [
|
|
6260
|
+
1, 0.588173710611846, 0.13936333128940975, 0.016632934041708368,
|
|
6261
|
+
0.0010002392131023491, 0.2425483752158723e-4,
|
|
6262
|
+
];
|
|
6263
|
+
/**
|
|
6264
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6265
|
+
* calculation for erfc(x) in the interval [11.5, 17].
|
|
6266
|
+
*/
|
|
6267
|
+
static erfImpIn = [
|
|
6268
|
+
-0.0005690799360109496, 0.0001694985403737623, 0.5184723545811009e-4,
|
|
6269
|
+
0.38281931223192885e-5, 0.8249899312818944e-7,
|
|
6270
|
+
];
|
|
6271
|
+
/**
|
|
6272
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6273
|
+
* calculation for erfc(x) in the interval [11.5, 17].
|
|
6274
|
+
*/
|
|
6275
|
+
static erfImpId = [
|
|
6276
|
+
1, 0.3396372500511393, 0.04347264787031066, 0.002485493352246371,
|
|
6277
|
+
0.5356333053371529e-4, -0.11749094440545958e-12,
|
|
6278
|
+
];
|
|
6279
|
+
/**
|
|
6280
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6281
|
+
* calculation for erfc(x) in the interval [17, 24].
|
|
6282
|
+
*/
|
|
6283
|
+
static erfImpJn = [
|
|
6284
|
+
-0.000241313599483991337, 0.5742249752025015e-4, 0.11599896292738377e-4,
|
|
6285
|
+
0.581762134402594e-6, 0.8539715550856736e-8,
|
|
6286
|
+
];
|
|
6287
|
+
/**
|
|
6288
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6289
|
+
* calculation for erfc(x) in the interval [17, 24].
|
|
6290
|
+
*/
|
|
6291
|
+
static erfImpJd = [
|
|
6292
|
+
1, 0.23304413829968784, 0.02041869405464403, 0.0007971856475643983,
|
|
6293
|
+
0.11701928167017232e-4,
|
|
6294
|
+
];
|
|
6295
|
+
/**
|
|
6296
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6297
|
+
* calculation for erfc(x) in the interval [24, 38].
|
|
6298
|
+
*/
|
|
6299
|
+
static erfImpKn = [
|
|
6300
|
+
-0.00014667469927776036, 0.1626665521122805e-4, 0.26911624850916523e-5,
|
|
6301
|
+
0.979584479468092e-7, 0.10199464762572346e-8,
|
|
6302
|
+
];
|
|
6303
|
+
/**
|
|
6304
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6305
|
+
* calculation for erfc(x) in the interval [24, 38].
|
|
6306
|
+
*/
|
|
6307
|
+
static erfImpKd = [
|
|
6308
|
+
1, 0.16590781294484722, 0.010336171619150588, 0.0002865930263738684,
|
|
6309
|
+
0.29840157084090034e-5,
|
|
6310
|
+
];
|
|
6311
|
+
/**
|
|
6312
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6313
|
+
* calculation for erfc(x) in the interval [38, 60].
|
|
6314
|
+
*/
|
|
6315
|
+
static erfImpLn = [
|
|
6316
|
+
-0.5839057976297718e-4, 0.4125103251054962e-5, 0.43179092242025094e-6,
|
|
6317
|
+
0.9933651555900132e-8, 0.653480510020105e-10,
|
|
6318
|
+
];
|
|
6319
|
+
/**
|
|
6320
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6321
|
+
* calculation for erfc(x) in the interval [38, 60].
|
|
6322
|
+
*/
|
|
6323
|
+
static erfImpLd = [
|
|
6324
|
+
1, 0.1050770860720399, 0.004142784286754756, 0.726338754644524e-4,
|
|
6325
|
+
0.477818471047398785e-6,
|
|
6326
|
+
];
|
|
6327
|
+
/**
|
|
6328
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6329
|
+
* calculation for erfc(x) in the interval [60, 85].
|
|
6330
|
+
*/
|
|
6331
|
+
static erfImpMn = [
|
|
6332
|
+
-0.196457797609229579e-4, 0.1572438876668007e-5, 0.5439025111927009e-7,
|
|
6333
|
+
0.3174724923691177e-9,
|
|
6334
|
+
];
|
|
6335
|
+
/**
|
|
6336
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6337
|
+
* calculation for erfc(x) in the interval [60, 85].
|
|
6338
|
+
*/
|
|
6339
|
+
static erfImpMd = [
|
|
6340
|
+
1, 0.05280398924095763, 0.0009268760691517533, 0.5410117232266303e-5,
|
|
6341
|
+
0.5350938458036424e-15,
|
|
6342
|
+
];
|
|
6343
|
+
/**
|
|
6344
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
6345
|
+
* calculation for erfc(x) in the interval [85, 110].
|
|
6346
|
+
*/
|
|
6347
|
+
static erfImpNn = [
|
|
6348
|
+
-0.789224703978723e-5, 0.622088451660987e-6, 0.1457284456768824e-7,
|
|
6349
|
+
0.603715505542715e-10,
|
|
6350
|
+
];
|
|
6351
|
+
/**
|
|
6352
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
6353
|
+
* calculation for erfc(x) in the interval [85, 110].
|
|
6354
|
+
*/
|
|
6355
|
+
static erfImpNd = [
|
|
6356
|
+
1, 0.037532884635629371, 0.0004679195359746253, 0.19384703927584565e-5,
|
|
6357
|
+
];
|
|
6358
|
+
//#endregion
|
|
6359
|
+
//#region Coefficients for erfInvImp
|
|
6360
|
+
/**
|
|
6361
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
6362
|
+
* calculation for erf^-1(z) in the interval [0, 0.5].
|
|
6363
|
+
*/
|
|
6364
|
+
static ervInvImpAn = [
|
|
6365
|
+
-0.0005087819496582806, -0.0083687481974173677, 0.033480662540974461,
|
|
6366
|
+
-0.012692614766297402, -0.03656379714117627, 0.02198786811111689,
|
|
6367
|
+
0.008226878746769157, -0.005387729650712429,
|
|
6368
|
+
];
|
|
6369
|
+
/**
|
|
6370
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
6371
|
+
* calculation for erf^-1(z) in the interval [0, 0.5].
|
|
6372
|
+
*/
|
|
6373
|
+
static ervInvImpAd = [
|
|
6374
|
+
1, -0.9700050433032906, -1.565745582341758, 1.5622155839842302,
|
|
6375
|
+
0.662328840472003, -0.7122890234154285, -0.05273963823400997,
|
|
6376
|
+
0.079528368734157168, -0.0023339375937419, 0.0008862163904564247,
|
|
6377
|
+
];
|
|
6378
|
+
/**
|
|
6379
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
6380
|
+
* calculation for erf^-1(z) in the interval [0.5, 0.75].
|
|
6381
|
+
*/
|
|
6382
|
+
static ervInvImpBn = [
|
|
6383
|
+
-0.2024335083559388, 0.10526468069939171, 8.3705032834312,
|
|
6384
|
+
17.6447298408374, -18.85106480587143, -44.6382324441787,
|
|
6385
|
+
17.445385985570866, 21.12946554483405, -3.671922547077293,
|
|
6386
|
+
];
|
|
6387
|
+
/**
|
|
6388
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
6389
|
+
* calculation for erf^-1(z) in the interval [0.5, 0.75].
|
|
6390
|
+
*/
|
|
6391
|
+
static ervInvImpBd = [
|
|
6392
|
+
1, 6.24264124854247537, 3.9713437953343869, -28.66081804998,
|
|
6393
|
+
-20.14326346804852, 48.56092131087399, 10.82686673554602,
|
|
6394
|
+
-22.64369334131397, 1.7211476576120028,
|
|
6395
|
+
];
|
|
6396
|
+
/**
|
|
6397
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
6398
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x less than 3.
|
|
6399
|
+
*/
|
|
6400
|
+
static ervInvImpCn = [
|
|
6401
|
+
-0.1311027816799519, -0.1637940471933171, 0.11703015634199525,
|
|
6402
|
+
0.387079738972604337, 0.3377855389120359, 0.1428695344081572,
|
|
6403
|
+
0.029015791000532906, 0.002145589953888053, -0.6794655751811264e-6,
|
|
6404
|
+
0.2852253317822171e-7, -0.681149956853777e-9,
|
|
6405
|
+
];
|
|
6406
|
+
/**
|
|
6407
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
6408
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x less than 3.
|
|
6409
|
+
*/
|
|
6410
|
+
static ervInvImpCd = [
|
|
6411
|
+
1, 3.466254072425672, 5.381683457070069, 4.778465929458438,
|
|
6412
|
+
2.5930192162362027, 0.848854343457902, 0.1522643382953318,
|
|
6413
|
+
0.01105924229346489,
|
|
6414
|
+
];
|
|
6415
|
+
/**
|
|
6416
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
6417
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 3 and 6.
|
|
6418
|
+
*/
|
|
6419
|
+
static ervInvImpDn = [
|
|
6420
|
+
-0.0350353787183178, -0.002224265292134479, 0.018557330651423107,
|
|
6421
|
+
0.009508047013259196, 0.001871234928195592, 0.00015754461742496055,
|
|
6422
|
+
0.460469890584318e-5, -0.2304047769118826e-9, 0.266339227425782e-11,
|
|
6423
|
+
];
|
|
6424
|
+
/**
|
|
6425
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
6426
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 3 and 6.
|
|
6427
|
+
*/
|
|
6428
|
+
static ervInvImpDd = [
|
|
6429
|
+
1, 1.365334981755406, 0.7620591645536234, 0.22009110576413124,
|
|
6430
|
+
0.03415891436709477, 0.00263861676657016, 0.7646752923027944e-4,
|
|
6431
|
+
];
|
|
6432
|
+
/**
|
|
6433
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
6434
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 6 and 18.
|
|
6435
|
+
*/
|
|
6436
|
+
static ervInvImpEn = [
|
|
6437
|
+
-0.016743100507663373, -0.001129514387455803, 0.001056288621524929,
|
|
6438
|
+
0.0002093863174875881, 0.14962478375834237e-4, 0.4496967899277065e-6,
|
|
6439
|
+
0.4625961635228786e-8, -0.281128735628831791e-13,
|
|
6440
|
+
0.9905570997331033e-16,
|
|
6441
|
+
];
|
|
6442
|
+
/**
|
|
6443
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
6444
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 6 and 18.
|
|
6445
|
+
*/
|
|
6446
|
+
static ervInvImpEd = [
|
|
6447
|
+
1, 0.5914293448864175, 0.1381518657490833, 0.01607460870936765,
|
|
6448
|
+
0.0009640118070051655, 0.275335474764726e-4, 0.282243172016108e-6,
|
|
6449
|
+
];
|
|
6450
|
+
/**
|
|
6451
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
6452
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
|
|
6453
|
+
*/
|
|
6454
|
+
static ervInvImpFn = [
|
|
6455
|
+
-0.0024978212791898131, -0.779190719229054e-5, 0.2547230374130275e-4,
|
|
6456
|
+
0.1623977773425109e-5, 0.3963410113048011685e-7, 0.4116328311909442e-9,
|
|
6457
|
+
0.145596286718675e-11, -0.11676501239718427e-17,
|
|
6458
|
+
];
|
|
6459
|
+
/**
|
|
6460
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
6461
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
|
|
6462
|
+
*/
|
|
6463
|
+
static ervInvImpFd = [
|
|
6464
|
+
1, 0.20712311221442251, 0.01694108381209759, 0.0006905382656226846,
|
|
6465
|
+
0.14500735981823264e-4, 0.14443775662814415e-6, 0.5097612765997785e-9,
|
|
6466
|
+
];
|
|
6467
|
+
/**
|
|
6468
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
6469
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
6470
|
+
*/
|
|
6471
|
+
static ervInvImpGn = [
|
|
6472
|
+
-0.0005390429110190786, -0.2839875900472772e-6, 0.8994651148922914e-6,
|
|
6473
|
+
0.2293458592659209e-7, 0.2255614448635001e-9, 0.9478466275030226e-12,
|
|
6474
|
+
0.13588013010892486e-14, -0.3488903933999489e-21,
|
|
6475
|
+
];
|
|
6476
|
+
/**
|
|
6477
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
6478
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
6479
|
+
*/
|
|
6480
|
+
static ervInvImpGd = [
|
|
6481
|
+
1, 0.08457462340018994, 0.002820929847262647, 0.4682929219408942e-4,
|
|
6482
|
+
0.3999688121938621e-6, 0.1618092908879045e-8, 0.2315586083102596e-11,
|
|
6483
|
+
];
|
|
6484
|
+
//#endregion
|
|
6485
|
+
//#region Evaluations
|
|
6486
|
+
/**
|
|
6487
|
+
* Calculates the error function.
|
|
6488
|
+
*
|
|
6489
|
+
* @param x The value to evaluate.
|
|
6490
|
+
* @returns The error function evaluated at x, or:
|
|
6491
|
+
* - 1 if `x == Number.POSITIVE_INFINITY`;
|
|
6492
|
+
* - -1 if `x == Number.NEGATIVE_INFINITY`.
|
|
6493
|
+
*/
|
|
6494
|
+
static erf(x) {
|
|
6495
|
+
if (x === 0) {
|
|
6496
|
+
return 0;
|
|
6497
|
+
}
|
|
6498
|
+
if (x === Number.POSITIVE_INFINITY) {
|
|
6499
|
+
return 1;
|
|
6500
|
+
}
|
|
6501
|
+
if (x === Number.NEGATIVE_INFINITY) {
|
|
6502
|
+
return -1;
|
|
6503
|
+
}
|
|
6504
|
+
if (Number.isNaN(x)) {
|
|
6505
|
+
return Number.NaN;
|
|
6506
|
+
}
|
|
6507
|
+
return this.erfImp(x, false);
|
|
6508
|
+
}
|
|
6509
|
+
/**
|
|
6510
|
+
* Calculates the inverse error function evaluated at z.
|
|
6511
|
+
*
|
|
6512
|
+
* @param z The value to evaluate.
|
|
6513
|
+
* @returns The inverse error function evaluated at z, or:
|
|
6514
|
+
* - `Number.POSITIVE_INFINITY` if `z >= 1`;
|
|
6515
|
+
* - `Number.NEGATIVE_INFINITY` if `z <= -1`.
|
|
6516
|
+
*/
|
|
6517
|
+
static erfInv(z) {
|
|
6518
|
+
if (z === 0) {
|
|
6519
|
+
return 0;
|
|
6520
|
+
}
|
|
6521
|
+
if (z >= 1) {
|
|
6522
|
+
return Number.POSITIVE_INFINITY;
|
|
6523
|
+
}
|
|
6524
|
+
if (z <= -1) {
|
|
6525
|
+
return Number.NEGATIVE_INFINITY;
|
|
6526
|
+
}
|
|
6527
|
+
if (Number.isNaN(z)) {
|
|
6528
|
+
return Number.NaN;
|
|
6529
|
+
}
|
|
6530
|
+
let p;
|
|
6531
|
+
let q;
|
|
6532
|
+
let s;
|
|
6533
|
+
if (z < 0) {
|
|
6534
|
+
p = -z;
|
|
6535
|
+
q = 1 - p;
|
|
6536
|
+
s = -1;
|
|
6537
|
+
}
|
|
6538
|
+
else {
|
|
6539
|
+
p = z;
|
|
6540
|
+
q = 1 - z;
|
|
6541
|
+
s = 1;
|
|
6542
|
+
}
|
|
6543
|
+
return this.erfInvImp(p, q, s);
|
|
6544
|
+
}
|
|
6545
|
+
/**
|
|
6546
|
+
* The implementation of the error function.
|
|
6547
|
+
*
|
|
6548
|
+
* @param z Where to evaluate the error function.
|
|
6549
|
+
* @param invert Whether to compute 1 - the error function.
|
|
6550
|
+
* @returns The error function.
|
|
6551
|
+
*/
|
|
6552
|
+
static erfImp(z, invert) {
|
|
6553
|
+
if (z < 0) {
|
|
6554
|
+
if (!invert) {
|
|
6555
|
+
return -this.erfImp(-z, false);
|
|
6556
|
+
}
|
|
6557
|
+
if (z < -0.5) {
|
|
6558
|
+
return 2 - this.erfImp(-z, true);
|
|
6559
|
+
}
|
|
6560
|
+
return 1 + this.erfImp(-z, false);
|
|
6561
|
+
}
|
|
6562
|
+
let result;
|
|
6563
|
+
// Big bunch of selection statements now to pick which
|
|
6564
|
+
// implementation to use, try to put most likely options
|
|
6565
|
+
// first:
|
|
6566
|
+
if (z < 0.5) {
|
|
6567
|
+
// We're going to calculate erf:
|
|
6568
|
+
if (z < 1e-10) {
|
|
6569
|
+
result = z * 1.125 + z * 0.003379167095512574;
|
|
6570
|
+
}
|
|
6571
|
+
else {
|
|
6572
|
+
// Worst case absolute error found: 6.688618532e-21
|
|
6573
|
+
result =
|
|
6574
|
+
z * 1.125 +
|
|
6575
|
+
(z * Polynomial.evaluate(z, this.erfImpAn)) /
|
|
6576
|
+
Polynomial.evaluate(z, this.erfImpAd);
|
|
6577
|
+
}
|
|
6578
|
+
}
|
|
6579
|
+
else if (z < 110) {
|
|
6580
|
+
// We'll be calculating erfc:
|
|
6581
|
+
invert = !invert;
|
|
6582
|
+
let r;
|
|
6583
|
+
let b;
|
|
6584
|
+
switch (true) {
|
|
6585
|
+
case z < 0.75:
|
|
6586
|
+
// Worst case absolute error found: 5.582813374e-21
|
|
6587
|
+
r =
|
|
6588
|
+
Polynomial.evaluate(z - 0.5, this.erfImpBn) /
|
|
6589
|
+
Polynomial.evaluate(z - 0.5, this.erfImpBd);
|
|
6590
|
+
b = 0.3440242112;
|
|
6591
|
+
break;
|
|
6592
|
+
case z < 1.25:
|
|
6593
|
+
// Worst case absolute error found: 4.01854729e-21
|
|
6594
|
+
r =
|
|
6595
|
+
Polynomial.evaluate(z - 1.25, this.erfImpDn) /
|
|
6596
|
+
Polynomial.evaluate(z - 1.25, this.erfImpDd);
|
|
6597
|
+
b = 0.4898625016;
|
|
6598
|
+
break;
|
|
6599
|
+
case z < 2.25:
|
|
6600
|
+
// Worst case absolute error found: 2.866005373e-21
|
|
6601
|
+
r =
|
|
6602
|
+
Polynomial.evaluate(z - 1.25, this.erfImpDn) /
|
|
6603
|
+
Polynomial.evaluate(z - 1.25, this.erfImpDd);
|
|
6604
|
+
b = 0.4898625016;
|
|
6605
|
+
break;
|
|
6606
|
+
case z < 3.5:
|
|
6607
|
+
// Worst case absolute error found: 1.045355789e-21
|
|
6608
|
+
r =
|
|
6609
|
+
Polynomial.evaluate(z - 2.25, this.erfImpEn) /
|
|
6610
|
+
Polynomial.evaluate(z - 2.25, this.erfImpEd);
|
|
6611
|
+
b = 0.5317370892;
|
|
6612
|
+
break;
|
|
6613
|
+
case z < 5.25:
|
|
6614
|
+
// Worst case absolute error found: 8.300028706e-22
|
|
6615
|
+
r =
|
|
6616
|
+
Polynomial.evaluate(z - 3.5, this.erfImpFn) /
|
|
6617
|
+
Polynomial.evaluate(z - 3.5, this.erfImpFd);
|
|
6618
|
+
b = 0.5489973426;
|
|
6619
|
+
break;
|
|
6620
|
+
case z < 8:
|
|
6621
|
+
// Worst case absolute error found: 1.700157534e-21
|
|
6622
|
+
r =
|
|
6623
|
+
Polynomial.evaluate(z - 5.25, this.erfImpGn) /
|
|
6624
|
+
Polynomial.evaluate(z - 5.25, this.erfImpGd);
|
|
6625
|
+
b = 0.5571740866;
|
|
6626
|
+
break;
|
|
6627
|
+
case z < 11.5:
|
|
6628
|
+
// Worst case absolute error found: 3.002278011e-22
|
|
6629
|
+
r =
|
|
6630
|
+
Polynomial.evaluate(z - 8, this.erfImpHn) /
|
|
6631
|
+
Polynomial.evaluate(z - 8, this.erfImpHd);
|
|
6632
|
+
b = 0.5609807968;
|
|
6633
|
+
break;
|
|
6634
|
+
case z < 17:
|
|
6635
|
+
// Worst case absolute error found: 6.741114695e-21
|
|
6636
|
+
r =
|
|
6637
|
+
Polynomial.evaluate(z - 11.5, this.erfImpIn) /
|
|
6638
|
+
Polynomial.evaluate(z - 11.5, this.erfImpId);
|
|
6639
|
+
b = 0.5626493692;
|
|
6640
|
+
break;
|
|
6641
|
+
case z < 24:
|
|
6642
|
+
// Worst case absolute error found: 7.802346984e-22
|
|
6643
|
+
r =
|
|
6644
|
+
Polynomial.evaluate(z - 17, this.erfImpJn) /
|
|
6645
|
+
Polynomial.evaluate(z - 17, this.erfImpJd);
|
|
6646
|
+
b = 0.5634598136;
|
|
6647
|
+
break;
|
|
6648
|
+
case z < 38:
|
|
6649
|
+
// Worst case absolute error found: 2.414228989e-22
|
|
6650
|
+
r =
|
|
6651
|
+
Polynomial.evaluate(z - 24, this.erfImpKn) /
|
|
6652
|
+
Polynomial.evaluate(z - 24, this.erfImpKd);
|
|
6653
|
+
b = 0.5638477802;
|
|
6654
|
+
break;
|
|
6655
|
+
case z < 60:
|
|
6656
|
+
// Worst case absolute error found: 5.896543869e-24
|
|
6657
|
+
r =
|
|
6658
|
+
Polynomial.evaluate(z - 38, this.erfImpLn) /
|
|
6659
|
+
Polynomial.evaluate(z - 38, this.erfImpLd);
|
|
6660
|
+
b = 0.5640528202;
|
|
6661
|
+
break;
|
|
6662
|
+
case z < 85:
|
|
6663
|
+
// Worst case absolute error found: 3.080612264e-21
|
|
6664
|
+
r =
|
|
6665
|
+
Polynomial.evaluate(z - 60, this.erfImpMn) /
|
|
6666
|
+
Polynomial.evaluate(z - 60, this.erfImpMd);
|
|
6667
|
+
b = 0.5641309023;
|
|
6668
|
+
break;
|
|
6669
|
+
default:
|
|
6670
|
+
// Worst case absolute error found: 8.094633491e-22
|
|
6671
|
+
r =
|
|
6672
|
+
Polynomial.evaluate(z - 85, this.erfImpNn) /
|
|
6673
|
+
Polynomial.evaluate(z - 85, this.erfImpNd);
|
|
6674
|
+
b = 0.5641584396;
|
|
6675
|
+
}
|
|
6676
|
+
const g = Math.exp(-z * z) / z;
|
|
6677
|
+
result = g * (b + r);
|
|
6678
|
+
}
|
|
6679
|
+
else {
|
|
6680
|
+
// Any value of z larger than 28 will underflow to zero:
|
|
6681
|
+
result = 0;
|
|
6682
|
+
invert = !invert;
|
|
6683
|
+
}
|
|
6684
|
+
if (invert) {
|
|
6685
|
+
result = 1 - result;
|
|
6686
|
+
}
|
|
6687
|
+
return result;
|
|
6688
|
+
}
|
|
6689
|
+
/**
|
|
6690
|
+
* The implementation of the inverse error function.
|
|
6691
|
+
*
|
|
6692
|
+
* @param p The first intermediate parameter.
|
|
6693
|
+
* @param q The second intermediate parameter.
|
|
6694
|
+
* @param s The third intermediate parameter.
|
|
6695
|
+
* @returns The inverse error function.
|
|
6696
|
+
*/
|
|
6697
|
+
static erfInvImp(p, q, s) {
|
|
6698
|
+
let result;
|
|
6699
|
+
if (p <= 0.5) {
|
|
6700
|
+
// Evaluate inverse erf using the rational approximation:
|
|
6701
|
+
//
|
|
6702
|
+
// x = p(p+10)(Y+R(p))
|
|
6703
|
+
//
|
|
6704
|
+
// Where Y is a constant, and R(p) is optimized for a low
|
|
6705
|
+
// absolute error compared to |Y|.
|
|
6706
|
+
//
|
|
6707
|
+
// double: Max error found: 2.001849e-18
|
|
6708
|
+
// long double: Max error found: 1.017064e-20
|
|
6709
|
+
// Maximum Deviation Found (actual error term at infinite precision) 8.030e-21
|
|
6710
|
+
const y = 0.0891314744949340820313;
|
|
6711
|
+
const g = p * (p + 10);
|
|
6712
|
+
const r = Polynomial.evaluate(p, this.ervInvImpAn) /
|
|
6713
|
+
Polynomial.evaluate(p, this.ervInvImpAd);
|
|
6714
|
+
result = g * (y + r);
|
|
6715
|
+
}
|
|
6716
|
+
else if (q >= 0.25) {
|
|
6717
|
+
// Rational approximation for 0.5 > q >= 0.25
|
|
6718
|
+
//
|
|
6719
|
+
// x = sqrt(-2*log(q)) / (Y + R(q))
|
|
6720
|
+
//
|
|
6721
|
+
// Where Y is a constant, and R(q) is optimized for a low
|
|
6722
|
+
// absolute error compared to Y.
|
|
6723
|
+
//
|
|
6724
|
+
// double : Max error found: 7.403372e-17
|
|
6725
|
+
// long double : Max error found: 6.084616e-20
|
|
6726
|
+
// Maximum Deviation Found (error term) 4.811e-20
|
|
6727
|
+
const y = 2.249481201171875;
|
|
6728
|
+
const g = Math.sqrt(-2 * Math.log(q));
|
|
6729
|
+
const xs = q - 0.25;
|
|
6730
|
+
const r = Polynomial.evaluate(xs, this.ervInvImpBn) /
|
|
6731
|
+
Polynomial.evaluate(xs, this.ervInvImpBd);
|
|
6732
|
+
result = g / (y + r);
|
|
6733
|
+
}
|
|
6734
|
+
else {
|
|
6735
|
+
// For q < 0.25 we have a series of rational approximations all
|
|
6736
|
+
// of the general form:
|
|
6737
|
+
//
|
|
6738
|
+
// let: x = sqrt(-log(q))
|
|
6739
|
+
//
|
|
6740
|
+
// Then the result is given by:
|
|
6741
|
+
//
|
|
6742
|
+
// x(Y+R(x-B))
|
|
6743
|
+
//
|
|
6744
|
+
// where Y is a constant, B is the lowest value of x for which
|
|
6745
|
+
// the approximation is valid, and R(x-B) is optimized for a low
|
|
6746
|
+
// absolute error compared to Y.
|
|
6747
|
+
//
|
|
6748
|
+
// Note that almost all code will really go through the first
|
|
6749
|
+
// or maybe second approximation. After than we're dealing with very
|
|
6750
|
+
// small input values indeed: 80 and 128 bit long double's go all the
|
|
6751
|
+
// way down to ~ 1e-5000 so the "tail" is rather long...
|
|
6752
|
+
const x = Math.sqrt(-Math.log(q));
|
|
6753
|
+
let y;
|
|
6754
|
+
let r;
|
|
6755
|
+
switch (true) {
|
|
6756
|
+
case x < 3: {
|
|
6757
|
+
// Max error found: 1.089051e-20
|
|
6758
|
+
y = 0.807220458984375;
|
|
6759
|
+
const xs = x - 1.125;
|
|
6760
|
+
r =
|
|
6761
|
+
Polynomial.evaluate(xs, this.ervInvImpCn) /
|
|
6762
|
+
Polynomial.evaluate(xs, this.ervInvImpCd);
|
|
6763
|
+
break;
|
|
6764
|
+
}
|
|
6765
|
+
case x < 6: {
|
|
6766
|
+
// Max error found: 8.389174e-21
|
|
6767
|
+
y = 0.93995571136474609375;
|
|
6768
|
+
const xs = x - 3;
|
|
6769
|
+
r =
|
|
6770
|
+
Polynomial.evaluate(xs, this.ervInvImpDn) /
|
|
6771
|
+
Polynomial.evaluate(xs, this.ervInvImpDd);
|
|
6772
|
+
break;
|
|
6773
|
+
}
|
|
6774
|
+
case x < 18: {
|
|
6775
|
+
// Max error found: 1.481312e-19
|
|
6776
|
+
y = 0.98362827301025390625;
|
|
6777
|
+
const xs = x - 6;
|
|
6778
|
+
r =
|
|
6779
|
+
Polynomial.evaluate(xs, this.ervInvImpEn) /
|
|
6780
|
+
Polynomial.evaluate(xs, this.ervInvImpEd);
|
|
6781
|
+
break;
|
|
6782
|
+
}
|
|
6783
|
+
case x < 44: {
|
|
6784
|
+
// Max error found: 5.697761e-20
|
|
6785
|
+
y = 0.99714565277099609375;
|
|
6786
|
+
const xs = x - 18;
|
|
6787
|
+
r =
|
|
6788
|
+
Polynomial.evaluate(xs, this.ervInvImpFn) /
|
|
6789
|
+
Polynomial.evaluate(xs, this.ervInvImpFd);
|
|
6790
|
+
break;
|
|
6791
|
+
}
|
|
6792
|
+
default: {
|
|
6793
|
+
// Max error found: 1.279746e-20
|
|
6794
|
+
y = 0.99941349029541015625;
|
|
6795
|
+
const xs = x - 44;
|
|
6796
|
+
r =
|
|
6797
|
+
Polynomial.evaluate(xs, this.ervInvImpGn) /
|
|
6798
|
+
Polynomial.evaluate(xs, this.ervInvImpGd);
|
|
6799
|
+
}
|
|
6800
|
+
}
|
|
6801
|
+
result = x * (y + r);
|
|
6802
|
+
}
|
|
6803
|
+
return s * result;
|
|
6804
|
+
}
|
|
6805
|
+
}
|
|
6806
|
+
|
|
6100
6807
|
class Interpolation {
|
|
6101
6808
|
static lerp(start, final, amount) {
|
|
6102
6809
|
return start + (final - start) * amount;
|
|
@@ -6673,6 +7380,7 @@ exports.DroidAPIRequestBuilder = DroidAPIRequestBuilder;
|
|
|
6673
7380
|
exports.DroidHitWindow = DroidHitWindow;
|
|
6674
7381
|
exports.EffectControlPoint = EffectControlPoint;
|
|
6675
7382
|
exports.EffectControlPointManager = EffectControlPointManager;
|
|
7383
|
+
exports.ErrorFunction = ErrorFunction;
|
|
6676
7384
|
exports.HitObject = HitObject;
|
|
6677
7385
|
exports.HitSampleInfo = HitSampleInfo;
|
|
6678
7386
|
exports.Interpolation = Interpolation;
|
|
@@ -6703,6 +7411,7 @@ exports.ModUtil = ModUtil;
|
|
|
6703
7411
|
exports.OsuAPIRequestBuilder = OsuAPIRequestBuilder;
|
|
6704
7412
|
exports.OsuHitWindow = OsuHitWindow;
|
|
6705
7413
|
exports.PathApproximator = PathApproximator;
|
|
7414
|
+
exports.Polynomial = Polynomial;
|
|
6706
7415
|
exports.Precision = Precision;
|
|
6707
7416
|
exports.RGBColor = RGBColor;
|
|
6708
7417
|
exports.SampleBankInfo = SampleBankInfo;
|