PalacePal/Pal.Common/PalaceMath.cs

23 lines
513 B
C#
Raw Normal View History

2024-07-06 11:14:59 +00:00
using System;
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);
}
}