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