1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:23:22 +08:00

Generalise p-norm function

This commit is contained in:
Bartłomiej Dach 2020-08-18 19:59:28 +02:00
parent 51d41515ef
commit cb5ea6aa9a

View File

@ -49,13 +49,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
return 0.79 - Math.Atan(staminaDifficulty / colorDifficulty - 12) / Math.PI / 2;
}
private double norm(double p, double v1, double v2, double v3)
private double norm(double p, params double[] values)
{
return Math.Pow(
Math.Pow(v1, p) +
Math.Pow(v2, p) +
Math.Pow(v3, p)
, 1 / p);
return Math.Pow(values.Sum(x => Math.Pow(x, p)), 1 / p);
}
private double rescale(double sr)