Core/Movement: Add time synchronisation (Needs tested)

Port From (https://github.com/TrinityCore/TrinityCore/commit/c19a4db1c12b8864d6c486ee8e2f0e058fb4155a)
This commit is contained in:
hondacrx
2021-12-02 22:34:04 -05:00
parent f5695f0cf2
commit a96fe1e47f
11 changed files with 586 additions and 75 deletions
+17
View File
@@ -18,6 +18,7 @@
using Framework.Constants;
using Framework.GameMath;
using System;
using System.Collections.Generic;
using System.Numerics;
public static class MathFunctions
@@ -269,6 +270,22 @@ public static class MathFunctions
return (ushort)((byte)l | (ushort)h << 8);
}
public static double Variance(this IEnumerable<uint> source)
{
int n = 0;
double mean = 0;
double M2 = 0;
foreach (var x in source)
{
n = n + 1;
double delta = x - mean;
mean = mean + delta / n;
M2 += delta * (x - mean);
}
return M2 / (n - 1);
}
//3d math
public static Box toWorldSpace(Matrix4x4 rotation, Vector3 translation, Box box)
{