2018-04-08 17:50:58 -04:00
|
|
|
|
using SharedLibraryCore.Helpers;
|
2018-03-22 14:50:09 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2018-04-08 17:50:58 -04:00
|
|
|
|
namespace IW4MAdmin.Plugins.Stats.Helpers
|
2018-03-22 14:50:09 -04:00
|
|
|
|
{
|
|
|
|
|
static class Extensions
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public static Vector3 FixIW4Angles(this Vector3 vector)
|
|
|
|
|
{
|
2018-03-26 00:51:25 -04:00
|
|
|
|
float X = vector.X >= 0 ? vector.X : 360.0f + vector.X;
|
|
|
|
|
float Y = vector.Y >= 0 ? vector.Y : 360.0f + vector.Y;
|
2018-03-22 14:50:09 -04:00
|
|
|
|
|
2019-07-17 13:29:51 -04:00
|
|
|
|
return new Vector3(Y, X, vector.Z);
|
2018-03-22 14:50:09 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static float ToRadians(this float value) => (float)Math.PI * value / 180.0f;
|
|
|
|
|
|
|
|
|
|
public static float ToDegrees(this float value) => value * 180.0f / (float)Math.PI;
|
2018-05-03 01:25:49 -04:00
|
|
|
|
|
|
|
|
|
public static double[] AngleStuff(Vector3 a, Vector3 b)
|
|
|
|
|
{
|
2018-09-11 15:28:37 -04:00
|
|
|
|
double deltaX = 180.0 - Math.Abs(Math.Abs(a.X - b.X) - 180.0);
|
2018-05-03 01:25:49 -04:00
|
|
|
|
double deltaY = 180.0 - Math.Abs(Math.Abs(a.Y - b.Y) - 180.0);
|
|
|
|
|
|
|
|
|
|
return new[] { deltaX, deltaY };
|
|
|
|
|
}
|
2018-03-22 14:50:09 -04:00
|
|
|
|
}
|
|
|
|
|
}
|