feature: cleaning up the API to accommodate .net 8 Numerics compatibility.

This commit is contained in:
ikpil 2023-10-17 23:40:07 +09:00
parent 587cebd32c
commit 75d00916f3
2 changed files with 20 additions and 12 deletions

View File

@ -16,18 +16,6 @@ namespace DotRecast.Core.Numerics
Y = y;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float Get(int idx)
{
if (0 == idx)
return X;
if (1 == idx)
return Y;
throw new IndexOutOfRangeException("vector2f index out of range");
}
public override bool Equals(object obj)
{
if (!(obj is RcVec2f))

View File

@ -0,0 +1,20 @@
using System;
using System.Runtime.CompilerServices;
using DotRecast.Core.Numerics;
namespace DotRecast.Core.Numerics
{
public static class RcVecExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Get(this RcVec2f v, int i)
{
switch (i)
{
case 0: return v.X;
case 1: return v.Y;
default: throw new IndexOutOfRangeException("vector2f index out of range");
}
}
}
}