PalacePal/Pal.Common/PalaceMath.cs

22 lines
499 B
C#
Raw Normal View History

using System.Numerics;
2023-03-30 20:01:43 +00:00
namespace Pal.Common;
public class PalaceMath
{
2023-03-30 20:01:43 +00:00
private static readonly Vector3 ScaleFactor = new(5);
2023-03-30 20:01:43 +00:00
public static bool IsNearlySamePosition(Vector3 a, Vector3 b)
{
a *= ScaleFactor;
b *= ScaleFactor;
return (int)a.X == (int)b.X && (int)a.Y == (int)b.Y && (int)a.Z == (int)b.Z;
}
2023-03-30 20:01:43 +00:00
public static int GetHashCode(Vector3 v)
{
v *= ScaleFactor;
return HashCode.Combine((int)v.X, (int)v.Y, (int)v.Z);
}
}