private void PerformHealthCheck(TileInSpace tile, TileInSpace checkedTile) { // do not health check the same object against itself if (tile.Equals(checkedTile)) { return; } // IDs must not be the same Assert.AreNotEqual(tile.ID, checkedTile.ID); // objects must not overlap //Assert.IsFalse(tile.OverlapsWith(checkedTile)); // XJB DEBUG if (tile.OverlapsWith(checkedTile)) { // this shall never happen => get debug strings string polyI = DumpTileToMathSage(tile, m_colors[0]); string polyJ = DumpTileToMathSage(checkedTile, m_colors[1]); string sage = polyI + polyJ + "p" + tile.ID + "+p" + checkedTile.ID; Assert.IsFalse(true); } // objects must not intersect //Assert.IsFalse(tile.IntersectsWith(checkedTile)); if (tile.IntersectsWith(checkedTile)) { // this shall never happen => get debug strings string polyI = DumpTileToMathSage(tile, m_colors[0]); string polyJ = DumpTileToMathSage(checkedTile, m_colors[1]); string sage = polyI + polyJ + "p" + tile.ID + "+p" + checkedTile.ID; // Petr DEBUG /* tile.Move(-tile.xpushingVector); * tile.PushingVector = tile.xpushingVector; * checkedTile.Move(-checkedTile.xpushingVector); * checkedTile.PushingVector = checkedTile.xpushingVector; * * UnitVector3D pushingDirection = TileInSpace.PushingDirection(xConnector.ConnectedTo); * if (tile == m_tilesWorld.Last()) * tile.PushingIntersected(checkedTile, pushingDirection); * else if (checkedTile == m_tilesWorld.Last()) * checkedTile.PushingIntersected(tile, pushingDirection); * else if (tile.xpushingVector.Length > checkedTile.xpushingVector.Length) * tile.PushingNonIntersected(checkedTile); * else * checkedTile.PushingNonIntersected(tile); */ Assert.IsFalse(true); } }
public void TestIntersection() { Assert.IsFalse(baseTile.IntersectsWith(eastTile)); Assert.IsFalse(baseTile.IntersectsWith(southTile)); Assert.IsFalse(eastTile.IntersectsWith(southTile)); Assert.IsFalse(topTile.IntersectsWith(eastTile)); Assert.IsFalse(topTile.IntersectsWith(southTile)); baseTile.Move(new Vector3D(MSystem.Tolerance / 10, -MSystem.Tolerance / 10, MSystem.Tolerance / 10)); Assert.IsFalse(baseTile.IntersectsWith(eastTile)); Assert.IsFalse(baseTile.IntersectsWith(southTile)); baseTile.Move(new Vector3D(MSystem.Tolerance * 10, -MSystem.Tolerance * 10, MSystem.Tolerance * 10)); Assert.IsTrue(baseTile.IntersectsWith(eastTile)); Assert.IsTrue(baseTile.IntersectsWith(southTile)); }