mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-16 05:34:25 +01:00
Add NearEqual for vectors.
This commit is contained in:
parent
d10043a69a
commit
5cdcb9288e
2 changed files with 16 additions and 1 deletions
|
|
@ -48,3 +48,18 @@ public readonly struct CustomizeParameterValue
|
|||
public override string ToString()
|
||||
=> _data.ToString();
|
||||
}
|
||||
|
||||
public static class VectorExtensions
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
public static bool NearEqual(this Vector3 lhs, Vector3 rhs, float eps = 1e-9f)
|
||||
=> (lhs - rhs).LengthSquared() < eps;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
public static bool NearEqual(this Vector4 lhs, Vector4 rhs, float eps = 1e-9f)
|
||||
=> (lhs - rhs).LengthSquared() < eps;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
public static bool NearEqual(this CustomizeParameterValue lhs, CustomizeParameterValue rhs, float eps = 1e-9f)
|
||||
=> NearEqual(lhs.InternalQuadruple, rhs.InternalQuadruple, eps);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue