[Upstream] Fix typo (recast4j fixes #150)

This commit is contained in:
ikpil 2023-07-21 14:37:14 +09:00
parent 971e07fde4
commit 2efa16eee7
5 changed files with 9 additions and 9 deletions

View File

@ -287,7 +287,7 @@ namespace DotRecast.Detour
Array.Copy(bestTile.data.verts, bestPoly.verts[j] * 3, polyVerts, j * 3, 3); Array.Copy(bestTile.data.verts, bestPoly.verts[j] * 3, polyVerts, j * 3, 3);
} }
float[] constrainedVerts = constraint.Aply(polyVerts, centerPos, maxRadius); float[] constrainedVerts = constraint.Apply(polyVerts, centerPos, maxRadius);
if (constrainedVerts != null) if (constrainedVerts != null)
{ {
int vertCount = constrainedVerts.Length / 3; int vertCount = constrainedVerts.Length / 3;

View File

@ -23,6 +23,6 @@ namespace DotRecast.Detour
{ {
public interface IPolygonByCircleConstraint public interface IPolygonByCircleConstraint
{ {
float[] Aply(float[] polyVerts, RcVec3f circleCenter, float radius); float[] Apply(float[] polyVerts, RcVec3f circleCenter, float radius);
} }
} }

View File

@ -10,7 +10,7 @@ namespace DotRecast.Detour
{ {
} }
public float[] Aply(float[] polyVerts, RcVec3f circleCenter, float radius) public float[] Apply(float[] polyVerts, RcVec3f circleCenter, float radius)
{ {
return polyVerts; return polyVerts;
} }

View File

@ -31,7 +31,7 @@ namespace DotRecast.Detour
return temp; return temp;
} }
public float[] Aply(float[] verts, RcVec3f center, float radius) public float[] Apply(float[] verts, RcVec3f center, float radius)
{ {
float radiusSqr = radius * radius; float radiusSqr = radius * radius;
int outsideVertex = -1; int outsideVertex = -1;

View File

@ -31,7 +31,7 @@ public class PolygonByCircleConstraintTest
{ {
float[] polygon = { -2, 0, 2, 2, 0, 2, 2, 0, -2, -2, 0, -2 }; float[] polygon = { -2, 0, 2, 2, 0, 2, 2, 0, -2, -2, 0, -2 };
RcVec3f center = RcVec3f.Of(1, 0, 1); RcVec3f center = RcVec3f.Of(1, 0, 1);
float[] constrained = _constraint.Aply(polygon, center, 6); float[] constrained = _constraint.Apply(polygon, center, 6);
Assert.That(constrained, Is.EqualTo(polygon)); Assert.That(constrained, Is.EqualTo(polygon));
} }
@ -43,7 +43,7 @@ public class PolygonByCircleConstraintTest
float[] polygon = { -2, 0, 2, 2, 0, 2, 2, 0, -2, -2, 0, -2 }; float[] polygon = { -2, 0, 2, 2, 0, 2, 2, 0, -2, -2, 0, -2 };
RcVec3f center = RcVec3f.Of(2, 0, 0); RcVec3f center = RcVec3f.Of(2, 0, 0);
float[] constrained = _constraint.Aply(polygon, center, 3); float[] constrained = _constraint.Apply(polygon, center, 3);
Assert.That(constrained.Length, Is.EqualTo(expectedSize)); Assert.That(constrained.Length, Is.EqualTo(expectedSize));
Assert.That(constrained, Is.SupersetOf(new[] { 2f, 0f, 2f, 2f, 0f, -2f })); Assert.That(constrained, Is.SupersetOf(new[] { 2f, 0f, 2f, 2f, 0f, -2f }));
} }
@ -54,7 +54,7 @@ public class PolygonByCircleConstraintTest
int expectedSize = 12 * 3; int expectedSize = 12 * 3;
float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 }; float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 };
RcVec3f center = RcVec3f.Of(-1, 0, -1); RcVec3f center = RcVec3f.Of(-1, 0, -1);
float[] constrained = _constraint.Aply(polygon, center, 2); float[] constrained = _constraint.Apply(polygon, center, 2);
Assert.That(constrained.Length, Is.EqualTo(expectedSize)); Assert.That(constrained.Length, Is.EqualTo(expectedSize));
@ -72,7 +72,7 @@ public class PolygonByCircleConstraintTest
int expectedSize = 9 * 3; int expectedSize = 9 * 3;
float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 }; float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 };
RcVec3f center = RcVec3f.Of(-2, 0, -1); RcVec3f center = RcVec3f.Of(-2, 0, -1);
float[] constrained = _constraint.Aply(polygon, center, 3); float[] constrained = _constraint.Apply(polygon, center, 3);
Assert.That(constrained.Length, Is.EqualTo(expectedSize)); Assert.That(constrained.Length, Is.EqualTo(expectedSize));
Assert.That(constrained, Is.SupersetOf(new[] { -2f, 0f, -4f, -4f, 0f, 0f, -3.4641016f, 0.0f, 1.6076951f, -2.0f, 0.0f, 2.0f })); Assert.That(constrained, Is.SupersetOf(new[] { -2f, 0f, -4f, -4f, 0f, 0f, -3.4641016f, 0.0f, 1.6076951f, -2.0f, 0.0f, 2.0f }));
@ -84,7 +84,7 @@ public class PolygonByCircleConstraintTest
int expectedSize = 7 * 3; int expectedSize = 7 * 3;
float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 }; float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 };
RcVec3f center = RcVec3f.Of(4, 0, 0); RcVec3f center = RcVec3f.Of(4, 0, 0);
float[] constrained = _constraint.Aply(polygon, center, 4); float[] constrained = _constraint.Apply(polygon, center, 4);
Assert.That(constrained.Length, Is.EqualTo(expectedSize)); Assert.That(constrained.Length, Is.EqualTo(expectedSize));
Assert.That(constrained, Is.SupersetOf(new[] { 1.5358982f, 0f, 3f, 2f, 0f, 3f, 3f, 0f, -3f })); Assert.That(constrained, Is.SupersetOf(new[] { 1.5358982f, 0f, 3f, 2f, 0f, 3f, 3f, 0f, -3f }));