diff --git a/src/DotRecast.Core/Numerics/RcVec3f.cs b/src/DotRecast.Core/Numerics/RcVec3f.cs index a78cd59..44f5867 100644 --- a/src/DotRecast.Core/Numerics/RcVec3f.cs +++ b/src/DotRecast.Core/Numerics/RcVec3f.cs @@ -442,7 +442,9 @@ namespace DotRecast.Core.Numerics [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Copy(ref RcVec3f @out, float[] @in, int i) { - Copy(ref @out, 0, @in, i); + @out.X = @in[i + 0]; + @out.Y = @in[i + 1]; + @out.Z = @in[i + 2]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -454,19 +456,11 @@ namespace DotRecast.Core.Numerics } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Copy(float[] @out, int n, RcVec3f @in, int m) + public static void Copy(float[] @out, int n, RcVec3f @in) { - @out[n] = @in[m]; - @out[n + 1] = @in[m + 1]; - @out[n + 2] = @in[m + 2]; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Copy(ref RcVec3f @out, int n, float[] @in, int m) - { - @out[n] = @in[m]; - @out[n + 1] = @in[m + 1]; - @out[n + 2] = @in[m + 2]; + @out[n + 0] = @in.X; + @out[n + 1] = @in.Y; + @out[n + 2] = @in.Z; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/DotRecast.Recast/RcMeshDetails.cs b/src/DotRecast.Recast/RcMeshDetails.cs index fa3dc4e..4415716 100644 --- a/src/DotRecast.Recast/RcMeshDetails.cs +++ b/src/DotRecast.Recast/RcMeshDetails.cs @@ -1088,7 +1088,7 @@ namespace DotRecast.Recast // Mark sample as added. samples[besti * 4 + 3] = 1; // Add the new sample point. - RcVec3f.Copy(verts, nverts * 3, bestpt, 0); + RcVec3f.Copy(verts, nverts * 3, bestpt); nverts++; // Create new triangulation. diff --git a/test/DotRecast.Core.Test/Vector3Tests.cs b/test/DotRecast.Core.Test/Vector3Tests.cs index dd6a7f0..5fdd4e8 100644 --- a/test/DotRecast.Core.Test/Vector3Tests.cs +++ b/test/DotRecast.Core.Test/Vector3Tests.cs @@ -8,7 +8,7 @@ namespace DotRecast.Core.Test; public class Vector3Tests { [Test] - [Repeat(10000)] + [Repeat(100000)] public void TestVectorLength() { var v1 = new Vector3(Random.Shared.NextSingle(), Random.Shared.NextSingle(), Random.Shared.NextSingle()); @@ -19,7 +19,7 @@ public class Vector3Tests } [Test] - [Repeat(10000)] + [Repeat(100000)] public void TestVectorSubtract() { var v1 = new Vector3(Random.Shared.NextSingle(), Random.Shared.NextSingle(), Random.Shared.NextSingle()); @@ -41,7 +41,7 @@ public class Vector3Tests [Test] - [Repeat(10000)] + [Repeat(100000)] public void TestVectorAdd() { var v1 = new Vector3(Random.Shared.NextSingle(), Random.Shared.NextSingle(), Random.Shared.NextSingle()); @@ -62,7 +62,7 @@ public class Vector3Tests } [Test] - [Repeat(10000)] + [Repeat(100000)] public void TestVectorNormalize() { var v1 = new Vector3(Random.Shared.NextSingle(), Random.Shared.NextSingle(), Random.Shared.NextSingle()); @@ -77,7 +77,7 @@ public class Vector3Tests } [Test] - [Repeat(10000)] + [Repeat(100000)] public void TestVectorCross() { var v1 = new Vector3(Random.Shared.NextSingle(), Random.Shared.NextSingle(), Random.Shared.NextSingle());