RcVec2f, 3f, string ToString

This commit is contained in:
ikpil 2023-06-13 14:53:51 +09:00
parent ca51085826
commit b1941432aa
2 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
namespace DotRecast.Core namespace DotRecast.Core
{ {
@ -28,6 +29,7 @@ namespace DotRecast.Core
return Equals((RcVec2f)obj); return Equals((RcVec2f)obj);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(RcVec2f other) public bool Equals(RcVec2f other)
{ {
return x.Equals(other.x) && return x.Equals(other.x) &&
@ -41,14 +43,21 @@ namespace DotRecast.Core
return hash; return hash;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(RcVec2f left, RcVec2f right) public static bool operator ==(RcVec2f left, RcVec2f right)
{ {
return left.Equals(right); return left.Equals(right);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(RcVec2f left, RcVec2f right) public static bool operator !=(RcVec2f left, RcVec2f right)
{ {
return !left.Equals(right); return !left.Equals(right);
} }
public override string ToString()
{
return $"{x}, {y}";
}
} }
} }

View File

@ -193,6 +193,7 @@ namespace DotRecast.Core
return Equals((RcVec3f)obj); return Equals((RcVec3f)obj);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(RcVec3f other) public bool Equals(RcVec3f other)
{ {
return x.Equals(other.x) && return x.Equals(other.x) &&
@ -255,6 +256,11 @@ namespace DotRecast.Core
y = Math.Max(y, @in[i + 1]); y = Math.Max(y, @in[i + 1]);
z = Math.Max(z, @in[i + 2]); z = Math.Max(z, @in[i + 2]);
} }
public override string ToString()
{
return $"{x}, {y}, {z}";
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(RcVec3f left, RcVec3f right) public static bool operator ==(RcVec3f left, RcVec3f right)