From 19136129ab182155599aaaf69480a94afde29cd1 Mon Sep 17 00:00:00 2001 From: ikpil Date: Fri, 13 Oct 2023 00:04:46 +0900 Subject: [PATCH] refactor: remve RcVec3f.Of(float[] f) --- src/DotRecast.Core/RcVec3f.cs | 13 ++++--------- src/DotRecast.Detour/DtNavMesh.cs | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/DotRecast.Core/RcVec3f.cs b/src/DotRecast.Core/RcVec3f.cs index 63c7b6d..eb47601 100644 --- a/src/DotRecast.Core/RcVec3f.cs +++ b/src/DotRecast.Core/RcVec3f.cs @@ -33,11 +33,6 @@ namespace DotRecast.Core public static RcVec3f UnitY { get; } = new RcVec3f(0.0f, 1.0f, 0.0f); public static RcVec3f UnitZ { get; } = new RcVec3f(0.0f, 0.0f, 1.0f); - public static RcVec3f Of(float[] f) - { - return Of(f, 0); - } - public static RcVec3f Of(float[] f, int idx) { return new RcVec3f(f[idx + 0], f[idx + 1], f[idx + 2]); @@ -61,11 +56,11 @@ namespace DotRecast.Core [MethodImpl(MethodImplOptions.AggressiveInlining)] - public RcVec3f(float[] f) + public RcVec3f(ReadOnlySpan values) { - X = f[0]; - Y = f[1]; - Z = f[2]; + X = values[0]; + Y = values[1]; + Z = values[2]; } public float this[int index] diff --git a/src/DotRecast.Detour/DtNavMesh.cs b/src/DotRecast.Detour/DtNavMesh.cs index 90ee7ce..5df8d3e 100644 --- a/src/DotRecast.Detour/DtNavMesh.cs +++ b/src/DotRecast.Detour/DtNavMesh.cs @@ -1071,7 +1071,7 @@ namespace DotRecast.Detour }; // Find polygon to connect to. - var refs = FindNearestPolyInTile(tile, RcVec3f.Of(con.pos), ext, out var nearestPt); + var refs = FindNearestPolyInTile(tile, new RcVec3f(con.pos[0], con.pos[1], con.pos[2]), ext, out var nearestPt); if (refs == 0) { continue;