ikpil 2024-05-03 00:31:10 +09:00
parent 9e9a3f0dc2
commit bef346a8cb
3 changed files with 5 additions and 5 deletions

View File

@ -2245,7 +2245,7 @@ namespace DotRecast.Detour
hit.path.Clear(); hit.path.Clear();
hit.pathCost = 0; hit.pathCost = 0;
RcVec3f[] verts = new RcVec3f[m_nav.GetMaxVertsPerPoly() + 1]; Span<RcVec3f> verts = stackalloc RcVec3f[m_nav.GetMaxVertsPerPoly() + 1];
RcVec3f curPos = RcVec3f.Zero; RcVec3f curPos = RcVec3f.Zero;
RcVec3f lastPos = RcVec3f.Zero; RcVec3f lastPos = RcVec3f.Zero;

View File

@ -342,7 +342,7 @@ namespace DotRecast.Detour
} }
public static bool IntersectSegmentPoly2D(RcVec3f p0, RcVec3f p1, public static bool IntersectSegmentPoly2D(RcVec3f p0, RcVec3f p1,
RcVec3f[] verts, int nverts, Span<RcVec3f> verts, int nverts,
out float tmin, out float tmax, out float tmin, out float tmax,
out int segMin, out int segMax) out int segMin, out int segMax)
{ {

View File

@ -296,8 +296,8 @@ namespace DotRecast.Recast
if (axis.Y * axis.Y > EPSILON) if (axis.Y * axis.Y > EPSILON)
{ {
RcVec3f[] rectangleOnStartPlane = new RcVec3f[4]; Span<RcVec3f> rectangleOnStartPlane = stackalloc RcVec3f[4];
RcVec3f[] rectangleOnEndPlane = new RcVec3f[4]; Span<RcVec3f> rectangleOnEndPlane = stackalloc RcVec3f[4];
float ds = RcVec3f.Dot(axis, start); float ds = RcVec3f.Dot(axis, start);
float de = RcVec3f.Dot(axis, end); float de = RcVec3f.Dot(axis, end);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -326,7 +326,7 @@ namespace DotRecast.Recast
return s; return s;
} }
private static float[] CylinderCapIntersection(RcVec3f start, float radiusSqr, float[] s, int i, RcVec3f[] rectangleOnPlane) private static float[] CylinderCapIntersection(RcVec3f start, float radiusSqr, float[] s, int i, Span<RcVec3f> rectangleOnPlane)
{ {
int j = (i + 1) % 4; int j = (i + 1) % 4;
// Ray against sphere intersection // Ray against sphere intersection