This commit is contained in:
ikpil 2023-04-29 13:29:40 +09:00
parent da8c66bd1a
commit 5ed9e602fb
23 changed files with 124 additions and 124 deletions

View File

@ -121,9 +121,9 @@ public class AbstractCrowdTest
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
{ {
Vector3f pos = new Vector3f(); Vector3f pos = new Vector3f();
pos[0] = startPos[0] + i * distance; pos.x = startPos.x + i * distance;
pos[1] = startPos[1]; pos.y = startPos.y;
pos[2] = startPos[2] + j * distance; pos.z = startPos.z + j * distance;
agents.Add(crowd.addAgent(pos, ap)); agents.Add(crowd.addAgent(pos, ap));
} }
} }
@ -154,7 +154,7 @@ public class AbstractCrowdTest
protected Vector3f calcVel(Vector3f pos, Vector3f tgt, float speed) protected Vector3f calcVel(Vector3f pos, Vector3f tgt, float speed)
{ {
Vector3f vel = vSub(tgt, pos); Vector3f vel = vSub(tgt, pos);
vel[1] = 0.0f; vel.y = 0.0f;
vNormalize(ref vel); vNormalize(ref vel);
vel = vScale(vel, speed); vel = vScale(vel, speed);
return vel; return vel;
@ -166,8 +166,8 @@ public class AbstractCrowdTest
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Console.WriteLine(ag.state + ", " + ag.targetState); Console.WriteLine(ag.state + ", " + ag.targetState);
Console.WriteLine(ag.npos[0] + ", " + ag.npos[1] + ", " + ag.npos[2]); Console.WriteLine(ag.npos.x + ", " + ag.npos.y + ", " + ag.npos.z);
Console.WriteLine(ag.nvel[0] + ", " + ag.nvel[1] + ", " + ag.nvel[2]); Console.WriteLine(ag.nvel.x + ", " + ag.nvel.y + ", " + ag.nvel.z);
} }
} }
} }

View File

@ -575,12 +575,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q0TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q0TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q0TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q0TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q0TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q0TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q0TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q0TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q0TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q0TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q0TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q0TVTA[i][5]).Within(0.001f));
} }
} }
} }
@ -598,12 +598,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q0TVT[i][0]).Within(0.001f)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q0TVT[i][0]).Within(0.001f));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q0TVT[i][1]).Within(0.001f)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q0TVT[i][1]).Within(0.001f));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q0TVT[i][2]).Within(0.001f)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q0TVT[i][2]).Within(0.001f));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q0TVT[i][3]).Within(0.001f)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q0TVT[i][3]).Within(0.001f));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q0TVT[i][4]).Within(0.001f)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q0TVT[i][4]).Within(0.001f));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q0TVT[i][5]).Within(0.001f)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q0TVT[i][5]).Within(0.001f));
} }
} }
} }
@ -620,12 +620,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q0TV[i][0]).Within(0.001f)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q0TV[i][0]).Within(0.001f));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q0TV[i][1]).Within(0.001f)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q0TV[i][1]).Within(0.001f));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q0TV[i][2]).Within(0.001f)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q0TV[i][2]).Within(0.001f));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q0TV[i][3]).Within(0.001f)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q0TV[i][3]).Within(0.001f));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q0TV[i][4]).Within(0.001f)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q0TV[i][4]).Within(0.001f));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q0TV[i][5]).Within(0.001f)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q0TV[i][5]).Within(0.001f));
} }
} }
} }
@ -642,12 +642,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q0T[i][0]).Within(0.001)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q0T[i][0]).Within(0.001));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q0T[i][1]).Within(0.001)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q0T[i][1]).Within(0.001));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q0T[i][2]).Within(0.001)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q0T[i][2]).Within(0.001));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q0T[i][3]).Within(0.001)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q0T[i][3]).Within(0.001));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q0T[i][4]).Within(0.001)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q0T[i][4]).Within(0.001));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q0T[i][5]).Within(0.001)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q0T[i][5]).Within(0.001));
} }
} }
} }
@ -665,12 +665,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q1TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q1TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q1TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q1TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q1TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q1TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q1TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q1TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q1TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q1TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q1TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q1TVTA[i][5]).Within(0.001f));
} }
} }
} }
@ -688,12 +688,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q2TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q2TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q2TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q2TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q2TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q2TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q2TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][5]).Within(0.001f));
} }
} }
} }
@ -711,12 +711,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q3TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q3TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q3TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q3TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q3TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q3TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f));
} }
} }
} }
@ -735,13 +735,13 @@ public class Crowd1Test : AbstractCrowdTest
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
foreach (CrowdAgent ag in crowd.getActiveAgents()) foreach (CrowdAgent ag in crowd.getActiveAgents())
{ {
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q3TVTAS[i][0]).Within(0.001f)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][0]).Within(0.001f));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q3TVTAS[i][1]).Within(0.001f)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][1]).Within(0.001f));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q3TVTAS[i][2]).Within(0.001f)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][2]).Within(0.001f));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q3TVTAS[i][3]).Within(0.001f)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][3]).Within(0.001f));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q3TVTAS[i][4]).Within(0.001f)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][4]).Within(0.001f));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q3TVTAS[i][5]).Within(0.001f)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][5]).Within(0.001f));
} }
} }
} }
} }

View File

@ -317,12 +317,12 @@ public class Crowd4Test : AbstractCrowdTest
{ {
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
CrowdAgent ag = agents[2]; CrowdAgent ag = agents[2];
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q2TVTA[i][0]).Within(0.001f), $"{i}"); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q2TVTA[i][0]).Within(0.001f), $"{i}");
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q2TVTA[i][1]).Within(0.001f), $"{i}"); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][1]).Within(0.001f), $"{i}");
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q2TVTA[i][2]).Within(0.001f), $"{i}"); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][2]).Within(0.001f), $"{i}");
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q2TVTA[i][3]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q2TVTA[i][3]).Within(0.001f), $"{i}");
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).Within(0.001f), $"{i}");
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q2TVTA[i][5]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][5]).Within(0.001f), $"{i}");
} }
} }
@ -339,12 +339,12 @@ public class Crowd4Test : AbstractCrowdTest
{ {
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
CrowdAgent ag = agents[2]; CrowdAgent ag = agents[2];
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q2TVTAS[i][0]).Within(0.001f), $"{i}"); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][0]).Within(0.001f), $"{i}");
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q2TVTAS[i][1]).Within(0.001f), $"{i}"); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][1]).Within(0.001f), $"{i}");
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q2TVTAS[i][2]).Within(0.001f), $"{i}"); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][2]).Within(0.001f), $"{i}");
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q2TVTAS[i][3]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][3]).Within(0.001f), $"{i}");
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q2TVTAS[i][4]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][4]).Within(0.001f), $"{i}");
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q2TVTAS[i][5]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][5]).Within(0.001f), $"{i}");
} }
} }
@ -359,12 +359,12 @@ public class Crowd4Test : AbstractCrowdTest
{ {
crowd.update(1 / 5f, null); crowd.update(1 / 5f, null);
CrowdAgent ag = agents[2]; CrowdAgent ag = agents[2];
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q2T[i][0]).Within(0.00001f), $"{i} - {ag.npos[0]} {EXPECTED_A1Q2T[i][0]}"); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q2T[i][0]).Within(0.00001f), $"{i} - {ag.npos.x} {EXPECTED_A1Q2T[i][0]}");
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q2T[i][1]).Within(0.00001f), $"{i} - {ag.npos[1]} {EXPECTED_A1Q2T[i][1]}"); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q2T[i][1]).Within(0.00001f), $"{i} - {ag.npos.y} {EXPECTED_A1Q2T[i][1]}");
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q2T[i][2]).Within(0.00001f), $"{i} - {ag.npos[2]} {EXPECTED_A1Q2T[i][2]}"); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q2T[i][2]).Within(0.00001f), $"{i} - {ag.npos.z} {EXPECTED_A1Q2T[i][2]}");
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q2T[i][3]).Within(0.00001f), $"{i} - {ag.nvel[0]} {EXPECTED_A1Q2T[i][3]}"); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q2T[i][3]).Within(0.00001f), $"{i} - {ag.nvel.x} {EXPECTED_A1Q2T[i][3]}");
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q2T[i][4]).Within(0.00001f), $"{i} - {ag.nvel[1]} {EXPECTED_A1Q2T[i][4]}"); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q2T[i][4]).Within(0.00001f), $"{i} - {ag.nvel.y} {EXPECTED_A1Q2T[i][4]}");
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q2T[i][5]).Within(0.00001f), $"{i} - {ag.nvel[2]} {EXPECTED_A1Q2T[i][5]}"); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q2T[i][5]).Within(0.00001f), $"{i} - {ag.nvel.z} {EXPECTED_A1Q2T[i][5]}");
} }
} }
} }

View File

@ -113,12 +113,12 @@ public class Crowd4VelocityTest : AbstractCrowdTest
} }
CrowdAgent ag = agents[1]; CrowdAgent ag = agents[1];
Assert.That(ag.npos[0], Is.EqualTo(EXPECTED_A1Q3TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q3TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos[1], Is.EqualTo(EXPECTED_A1Q3TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos[2], Is.EqualTo(EXPECTED_A1Q3TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel[0], Is.EqualTo(EXPECTED_A1Q3TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q3TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel[1], Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel[2], Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f));
} }
} }
} }

View File

@ -82,4 +82,4 @@ public class PathCorridorTest
Assert.That(path.Count, Is.EqualTo(2)); Assert.That(path.Count, Is.EqualTo(2));
Assert.That(path, Is.EqualTo(new List<StraightPathItem> { straightPath[2], straightPath[3] })); Assert.That(path, Is.EqualTo(new List<StraightPathItem> { straightPath[2], straightPath[3] }));
} }
} }

View File

@ -111,4 +111,4 @@ public class RecastTestMeshBuilder
{ {
return meshData; return meshData;
} }
} }

View File

@ -78,4 +78,4 @@ public class VoxelFileReaderTest
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(Vector3f.Of(-101.25f, 0f, -101.25f))); Assert.That(f.tiles[0].boundsMin, Is.EqualTo(Vector3f.Of(-101.25f, 0f, -101.25f)));
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(Vector3f.Of(-78.75f, 5.0f, -78.75f))); Assert.That(f.tiles[0].boundsMax, Is.EqualTo(Vector3f.Of(-78.75f, 5.0f, -78.75f)));
} }
} }

View File

@ -99,4 +99,4 @@ public class VoxelFileReaderWriterTest
using var brIn = new BinaryReader(msIn); using var brIn = new BinaryReader(msIn);
return reader.read(brIn); return reader.read(brIn);
} }
} }

View File

@ -137,4 +137,4 @@ public class UnityAStarPathfindingImporterTest
using var os = new BinaryWriter(fs); using var os = new BinaryWriter(fs);
writer.write(os, mesh, ByteOrder.LITTLE_ENDIAN, true); writer.write(os, mesh, ByteOrder.LITTLE_ENDIAN, true);
} }
} }

View File

@ -155,26 +155,26 @@ public class FindPolysAroundShapeTest : AbstractDetourTest
private float[] getQueryPoly(Vector3f m_spos, Vector3f m_epos) private float[] getQueryPoly(Vector3f m_spos, Vector3f m_epos)
{ {
float nx = (m_epos[2] - m_spos[2]) * 0.25f; float nx = (m_epos.z - m_spos.z) * 0.25f;
float nz = -(m_epos[0] - m_spos[0]) * 0.25f; float nz = -(m_epos.x - m_spos.x) * 0.25f;
float agentHeight = 2.0f; float agentHeight = 2.0f;
float[] m_queryPoly = new float[12]; float[] m_queryPoly = new float[12];
m_queryPoly[0] = m_spos[0] + nx * 1.2f; m_queryPoly[0] = m_spos.x + nx * 1.2f;
m_queryPoly[1] = m_spos[1] + agentHeight / 2; m_queryPoly[1] = m_spos.y + agentHeight / 2;
m_queryPoly[2] = m_spos[2] + nz * 1.2f; m_queryPoly[2] = m_spos.z + nz * 1.2f;
m_queryPoly[3] = m_spos[0] - nx * 1.3f; m_queryPoly[3] = m_spos.x - nx * 1.3f;
m_queryPoly[4] = m_spos[1] + agentHeight / 2; m_queryPoly[4] = m_spos.y + agentHeight / 2;
m_queryPoly[5] = m_spos[2] - nz * 1.3f; m_queryPoly[5] = m_spos.z - nz * 1.3f;
m_queryPoly[6] = m_epos[0] - nx * 0.8f; m_queryPoly[6] = m_epos.x - nx * 0.8f;
m_queryPoly[7] = m_epos[1] + agentHeight / 2; m_queryPoly[7] = m_epos.y + agentHeight / 2;
m_queryPoly[8] = m_epos[2] - nz * 0.8f; m_queryPoly[8] = m_epos.z - nz * 0.8f;
m_queryPoly[9] = m_epos[0] + nx; m_queryPoly[9] = m_epos.x + nx;
m_queryPoly[10] = m_epos[1] + agentHeight / 2; m_queryPoly[10] = m_epos.y + agentHeight / 2;
m_queryPoly[11] = m_epos[2] + nz; m_queryPoly[11] = m_epos.z + nz;
return m_queryPoly; return m_queryPoly;
} }
} }

View File

@ -114,4 +114,4 @@ public class MeshSetReaderTest
Assert.That(tiles[0].data.polys.Length, Is.EqualTo(5)); Assert.That(tiles[0].data.polys.Length, Is.EqualTo(5));
Assert.That(tiles[0].data.verts.Length, Is.EqualTo(17 * 3)); Assert.That(tiles[0].data.verts.Length, Is.EqualTo(17 * 3));
} }
} }

View File

@ -119,4 +119,4 @@ public class MeshSetReaderWriterTest
Assert.That(tiles[0].data.polys.Length, Is.EqualTo(5)); Assert.That(tiles[0].data.polys.Length, Is.EqualTo(5));
Assert.That(tiles[0].data.verts.Length, Is.EqualTo(17 * 3)); Assert.That(tiles[0].data.verts.Length, Is.EqualTo(17 * 3));
} }
} }

View File

@ -66,4 +66,4 @@ public class NavMeshBuilderTest
Assert.That(nmd.polys[118].getArea(), Is.EqualTo(2)); Assert.That(nmd.polys[118].getArea(), Is.EqualTo(2));
Assert.That(nmd.polys[118].getType(), Is.EqualTo(Poly.DT_POLYTYPE_OFFMESH_CONNECTION)); Assert.That(nmd.polys[118].getType(), Is.EqualTo(Poly.DT_POLYTYPE_OFFMESH_CONNECTION));
} }
} }

View File

@ -49,10 +49,10 @@ public class RandomPointTest : AbstractDetourTest
bmax[1] = j == 0 ? tileAndPoly.Item1.data.verts[v + 2] : Math.Max(bmax[1], tileAndPoly.Item1.data.verts[v + 2]); bmax[1] = j == 0 ? tileAndPoly.Item1.data.verts[v + 2] : Math.Max(bmax[1], tileAndPoly.Item1.data.verts[v + 2]);
} }
Assert.That(point.result.getRandomPt()[0] >= bmin[0], Is.True); Assert.That(point.result.getRandomPt().x >= bmin[0], Is.True);
Assert.That(point.result.getRandomPt()[0] <= bmax[0], Is.True); Assert.That(point.result.getRandomPt().x <= bmax[0], Is.True);
Assert.That(point.result.getRandomPt()[2] >= bmin[1], Is.True); Assert.That(point.result.getRandomPt().z >= bmin[1], Is.True);
Assert.That(point.result.getRandomPt()[2] <= bmax[1], Is.True); Assert.That(point.result.getRandomPt().z <= bmax[1], Is.True);
} }
} }
@ -80,10 +80,10 @@ public class RandomPointTest : AbstractDetourTest
bmax[1] = j == 0 ? tileAndPoly.Item1.data.verts[v + 2] : Math.Max(bmax[1], tileAndPoly.Item1.data.verts[v + 2]); bmax[1] = j == 0 ? tileAndPoly.Item1.data.verts[v + 2] : Math.Max(bmax[1], tileAndPoly.Item1.data.verts[v + 2]);
} }
Assert.That(point.getRandomPt()[0] >= bmin[0], Is.True); Assert.That(point.getRandomPt().x >= bmin[0], Is.True);
Assert.That(point.getRandomPt()[0] <= bmax[0], Is.True); Assert.That(point.getRandomPt().x <= bmax[0], Is.True);
Assert.That(point.getRandomPt()[2] >= bmin[1], Is.True); Assert.That(point.getRandomPt().z >= bmin[1], Is.True);
Assert.That(point.getRandomPt()[2] <= bmax[1], Is.True); Assert.That(point.getRandomPt().z <= bmax[1], Is.True);
} }
} }
@ -139,4 +139,4 @@ public class RandomPointTest : AbstractDetourTest
Console.WriteLine("Random point around circle: " + (t2 - t1) / TimeSpan.TicksPerMillisecond + "ms"); Console.WriteLine("Random point around circle: " + (t2 - t1) / TimeSpan.TicksPerMillisecond + "ms");
Console.WriteLine("Random point within circle: " + (t3 - t2) / TimeSpan.TicksPerMillisecond + "ms"); Console.WriteLine("Random point within circle: " + (t3 - t2) / TimeSpan.TicksPerMillisecond + "ms");
} }
} }

View File

@ -112,4 +112,4 @@ public class RecastTestMeshBuilder
{ {
return meshData; return meshData;
} }
} }

View File

@ -76,4 +76,4 @@ public class AbstractTileCacheTest
TileCacheCompressorFactory.get(cCompatibility), new TestTileCacheMeshProcess()); TileCacheCompressorFactory.get(cCompatibility), new TestTileCacheMeshProcess());
return tc; return tc;
} }
} }

View File

@ -222,4 +222,4 @@ public class TileCacheReaderTest
Assert.That(data.verts[6], Is.EqualTo(48.484783f).Within(0.0001f)); Assert.That(data.verts[6], Is.EqualTo(48.484783f).Within(0.0001f));
Assert.That(data.verts[9], Is.EqualTo(48.484783f).Within(0.0001f)); Assert.That(data.verts[9], Is.EqualTo(48.484783f).Within(0.0001f));
} }
} }

View File

@ -99,4 +99,4 @@ public class TempObstaclesTest : AbstractTileCacheTest
Assert.That(tile.data.header.vertCount, Is.EqualTo(16)); Assert.That(tile.data.header.vertCount, Is.EqualTo(16));
Assert.That(tile.data.header.polyCount, Is.EqualTo(6)); Assert.That(tile.data.header.polyCount, Is.EqualTo(6));
} }
} }

View File

@ -126,4 +126,4 @@ public class TestTileLayerBuilder : AbstractTileLayersBuilder
HeightfieldLayerSet lset = rcBuilder.buildLayers(geom, cfg); HeightfieldLayerSet lset = rcBuilder.buildLayers(geom, cfg);
return lset; return lset;
} }
} }

View File

@ -286,4 +286,4 @@ public class TileCacheTest : AbstractTileCacheTest
Assert.That(data.detailVerts.Length, Is.EqualTo(0)); Assert.That(data.detailVerts.Length, Is.EqualTo(0));
Assert.That(data.detailTris.Length, Is.EqualTo(4 * 3)); Assert.That(data.detailTris.Length, Is.EqualTo(4 * 3));
} }
} }

View File

@ -155,4 +155,4 @@ public class RecastLayersTest
HeightfieldLayerSet lset = builder.buildLayers(geom, bcfg); HeightfieldLayerSet lset = builder.buildLayers(geom, bcfg);
return lset; return lset;
} }
} }

View File

@ -277,9 +277,9 @@ public class RecastSoloMeshTest
using StreamWriter fw = new StreamWriter(path); using StreamWriter fw = new StreamWriter(path);
for (int v = 0; v < mesh.nverts; v++) for (int v = 0; v < mesh.nverts; v++)
{ {
fw.Write("v " + (mesh.bmin[0] + mesh.verts[v * 3] * mesh.cs) + " " fw.Write("v " + (mesh.bmin.x + mesh.verts[v * 3] * mesh.cs) + " "
+ (mesh.bmin[1] + mesh.verts[v * 3 + 1] * mesh.ch) + " " + (mesh.bmin.y + mesh.verts[v * 3 + 1] * mesh.ch) + " "
+ (mesh.bmin[2] + mesh.verts[v * 3 + 2] * mesh.cs) + "\n"); + (mesh.bmin.z + mesh.verts[v * 3 + 2] * mesh.cs) + "\n");
} }
for (int i = 0; i < mesh.npolys; i++) for (int i = 0; i < mesh.npolys; i++)

View File

@ -53,4 +53,4 @@ public class RecastTest
Assert.That(areas[0], Is.EqualTo(RC_NULL_AREA), "Slopes equal to the max slope are considered unwalkable."); Assert.That(areas[0], Is.EqualTo(RC_NULL_AREA), "Slopes equal to the max slope are considered unwalkable.");
} }
} }
} }