forked from mirror/DotRecast
refactor: RcVector.Copy
This commit is contained in:
parent
f5194e63b2
commit
e4dc81b027
|
@ -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)]
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue