From b1941432aa8ce56a07092edb688920d3246e324e Mon Sep 17 00:00:00 2001 From: ikpil Date: Tue, 13 Jun 2023 14:53:51 +0900 Subject: [PATCH] RcVec2f, 3f, string ToString --- src/DotRecast.Core/RcVec2f.cs | 9 +++++++++ src/DotRecast.Core/RcVec3f.cs | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/DotRecast.Core/RcVec2f.cs b/src/DotRecast.Core/RcVec2f.cs index efdfc7a..192b2fb 100644 --- a/src/DotRecast.Core/RcVec2f.cs +++ b/src/DotRecast.Core/RcVec2f.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; namespace DotRecast.Core { @@ -28,6 +29,7 @@ namespace DotRecast.Core return Equals((RcVec2f)obj); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(RcVec2f other) { return x.Equals(other.x) && @@ -41,14 +43,21 @@ namespace DotRecast.Core return hash; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(RcVec2f left, RcVec2f right) { return left.Equals(right); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(RcVec2f left, RcVec2f right) { return !left.Equals(right); } + + public override string ToString() + { + return $"{x}, {y}"; + } } } \ No newline at end of file diff --git a/src/DotRecast.Core/RcVec3f.cs b/src/DotRecast.Core/RcVec3f.cs index 0af129c..7abb28d 100644 --- a/src/DotRecast.Core/RcVec3f.cs +++ b/src/DotRecast.Core/RcVec3f.cs @@ -193,6 +193,7 @@ namespace DotRecast.Core return Equals((RcVec3f)obj); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(RcVec3f other) { return x.Equals(other.x) && @@ -255,6 +256,11 @@ namespace DotRecast.Core y = Math.Max(y, @in[i + 1]); z = Math.Max(z, @in[i + 2]); } + + public override string ToString() + { + return $"{x}, {y}, {z}"; + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(RcVec3f left, RcVec3f right)