forked from mirror/DotRecast
feature: cleaning up the API to accommodate .net 8 Numerics compatibility.
This commit is contained in:
parent
587cebd32c
commit
75d00916f3
|
@ -16,18 +16,6 @@ namespace DotRecast.Core.Numerics
|
||||||
Y = y;
|
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)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
if (!(obj is RcVec2f))
|
if (!(obj is RcVec2f))
|
||||||
|
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue