forked from mirror/DotRecast
Removed RcVecUtils.Create(float[] values)
This commit is contained in:
parent
ed7173dd51
commit
fd03f0f12f
|
@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Removed RcVecUtils.Subtract(float[] verts, int i, int j)
|
||||
- Removed RcMeshDetails.VdistSq2(float[], float[])
|
||||
- Removed RcVecUtils.Min(), RcVecUtils.Max()
|
||||
- Removed RcVecUtils.Create(float[] values)
|
||||
|
||||
### Special Thanks
|
||||
- [@Doprez](https://github.com/Doprez)
|
||||
|
|
|
@ -50,6 +50,19 @@ namespace DotRecast.Core.Numerics
|
|||
Z = f;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public RcVec3f(ReadOnlySpan<float> values)
|
||||
{
|
||||
if (values.Length < 3)
|
||||
{
|
||||
RcThrowHelper.ThrowArgumentOutOfRangeException(nameof(values));
|
||||
}
|
||||
|
||||
X = values[0];
|
||||
Y = values[1];
|
||||
Z = values[2];
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly float Length()
|
||||
|
|
|
@ -7,12 +7,6 @@ namespace DotRecast.Core.Numerics
|
|||
{
|
||||
public const float EPSILON = 1e-6f;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RcVec3f Create(float[] values)
|
||||
{
|
||||
return Create(values, 0);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RcVec3f Create(Span<float> values, int n)
|
||||
{
|
||||
|
@ -112,26 +106,6 @@ namespace DotRecast.Core.Numerics
|
|||
return v;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RcVec3f Min(RcVec3f v, float[] @in, int i)
|
||||
{
|
||||
return new RcVec3f(
|
||||
(v.X < @in[i + 0]) ? v.X : @in[i + 0],
|
||||
(v.Y < @in[i + 1]) ? v.Y : @in[i + 1],
|
||||
(v.Z < @in[i + 2]) ? v.Z : @in[i + 2]
|
||||
);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RcVec3f Max(RcVec3f v, float[] @in, int i)
|
||||
{
|
||||
return new RcVec3f(
|
||||
(v.X > @in[i + 0]) ? v.X : @in[i + 0],
|
||||
(v.Y > @in[i + 1]) ? v.Y : @in[i + 1],
|
||||
(v.Z > @in[i + 2]) ? v.Z : @in[i + 2]
|
||||
);
|
||||
}
|
||||
|
||||
/// Derives the distance between the specified points on the xz-plane.
|
||||
/// @param[in] v1 A point. [(x, y, z)]
|
||||
/// @param[in] v2 A point. [(x, y, z)]
|
||||
|
|
|
@ -15,6 +15,12 @@ namespace DotRecast.Core
|
|||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void ThrowArgumentOutOfRangeException(string argument)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(argument);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void StackOverflow()
|
||||
{
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace DotRecast.Detour.Crowd
|
|||
else if (n == 0)
|
||||
{
|
||||
// The first polyref is bad, use current safe values.
|
||||
m_pos = RcVecUtils.Create(safePos);
|
||||
m_pos = new RcVec3f(safePos);
|
||||
m_path.Clear();
|
||||
m_path.Add(safeRef);
|
||||
m_npath = 1;
|
||||
|
|
|
@ -57,8 +57,8 @@ namespace DotRecast.Recast.Toolset.Geom
|
|||
this.faces = faces;
|
||||
normals = new float[faces.Length];
|
||||
CalculateNormals();
|
||||
bmin = RcVecUtils.Create(vertices);
|
||||
bmax = RcVecUtils.Create(vertices);
|
||||
bmin = new RcVec3f(vertices);
|
||||
bmax = new RcVec3f(vertices);
|
||||
for (int i = 1; i < vertices.Length / 3; i++)
|
||||
{
|
||||
bmin = RcVec3f.Min(bmin, RcVecUtils.Create(vertices, i * 3));
|
||||
|
|
|
@ -77,8 +77,8 @@ namespace DotRecast.Recast.Geom
|
|||
this.faces = faces;
|
||||
normals = new float[faces.Length];
|
||||
CalculateNormals();
|
||||
bmin = RcVecUtils.Create(vertices);
|
||||
bmax = RcVecUtils.Create(vertices);
|
||||
bmin = new RcVec3f(vertices);
|
||||
bmax = new RcVec3f(vertices);
|
||||
for (int i = 1; i < vertices.Length / 3; i++)
|
||||
{
|
||||
bmin = RcVec3f.Min(bmin, RcVecUtils.Create(vertices, i * 3));
|
||||
|
|
|
@ -456,8 +456,8 @@ namespace DotRecast.Recast
|
|||
int zStride = xSize; // For readability
|
||||
|
||||
// Compute the bounding box of the polygon
|
||||
RcVec3f bmin = RcVecUtils.Create(verts);
|
||||
RcVec3f bmax = RcVecUtils.Create(verts);
|
||||
RcVec3f bmin = new RcVec3f(verts);
|
||||
RcVec3f bmax = new RcVec3f(verts);
|
||||
for (int i = 3; i < verts.Length; i += 3)
|
||||
{
|
||||
bmin = RcVec3f.Min(bmin, RcVecUtils.Create(verts, i));
|
||||
|
|
|
@ -525,7 +525,7 @@ namespace DotRecast.Recast
|
|||
{
|
||||
if (MathF.Abs(planes[j][1]) > EPSILON)
|
||||
{
|
||||
float dotNormalPoint = RcVec3f.Dot(RcVecUtils.Create(planes[j]), point);
|
||||
float dotNormalPoint = RcVec3f.Dot(new RcVec3f(planes[j]), point);
|
||||
float t = (planes[j][3] - dotNormalPoint) / planes[j][1];
|
||||
float y = point.Y + t;
|
||||
bool valid = true;
|
||||
|
@ -729,15 +729,15 @@ namespace DotRecast.Recast
|
|||
private static bool RayTriangleIntersection(RcVec3f point, int plane, float[][] planes, out float y)
|
||||
{
|
||||
y = 0.0f;
|
||||
float t = (planes[plane][3] - RcVec3f.Dot(RcVecUtils.Create(planes[plane]), point)) / planes[plane][1];
|
||||
float t = (planes[plane][3] - RcVec3f.Dot(new RcVec3f(planes[plane]), point)) / planes[plane][1];
|
||||
RcVec3f s = new RcVec3f(point.X, point.Y + t, point.Z);
|
||||
float u = RcVec3f.Dot(s, RcVecUtils.Create(planes[plane + 1])) - planes[plane + 1][3];
|
||||
float u = RcVec3f.Dot(s, new RcVec3f(planes[plane + 1])) - planes[plane + 1][3];
|
||||
if (u < 0.0f || u > 1.0f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float v = RcVec3f.Dot(s, RcVecUtils.Create(planes[plane + 2])) - planes[plane + 2][3];
|
||||
float v = RcVec3f.Dot(s, new RcVec3f(planes[plane + 2])) - planes[plane + 2][3];
|
||||
if (v < 0.0f)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -931,8 +931,8 @@ namespace DotRecast.Recast
|
|||
if (sampleDist > 0)
|
||||
{
|
||||
// Create sample locations in a grid.
|
||||
RcVec3f bmin = RcVecUtils.Create(@in);
|
||||
RcVec3f bmax = RcVecUtils.Create(@in);
|
||||
RcVec3f bmin = new RcVec3f(@in);
|
||||
RcVec3f bmax = new RcVec3f(@in);
|
||||
for (int i = 1; i < nin; ++i)
|
||||
{
|
||||
bmin = RcVec3f.Min(bmin, RcVecUtils.Create(@in, i * 3));
|
||||
|
|
Loading…
Reference in New Issue