示例#1
0
        public void GetObjectsNearConnectorTest2()
        {
            var testTile = _testTilesWorld.First();
            // Construct a lower part of a dodecahedron (1+5 tiles)

            TileInSpace newlyCreatedTile;

            Assert.IsTrue(_testTilesWorld.Add(_testMSystem.Tiles["q1"], testTile.Connectors[0], out newlyCreatedTile));
            Assert.IsTrue(_testTilesWorld.Add(_testMSystem.Tiles["q1"], testTile.Connectors[1], out newlyCreatedTile));
            Assert.IsTrue(_testTilesWorld.Add(_testMSystem.Tiles["q1"], testTile.Connectors[2], out newlyCreatedTile));
            Assert.IsTrue(_testTilesWorld.Add(_testMSystem.Tiles["q1"], testTile.Connectors[3], out newlyCreatedTile));
            Assert.IsTrue(_testTilesWorld.Add(_testMSystem.Tiles["q1"], testTile.Connectors[4], out newlyCreatedTile));
            //Assert.IsTrue(_testTilesWorld.Add(_testMSystem.Tiles["q1"], _testTilesWorld.ToArray()[1].Connectors[3]));

            var aBox = new Box3D(new Point3D(-5.87, -8.09, 0.01), new Point3D(-5.37, -7.59, 0.5));
            var aSet = new NamedMultiset(new[] { _testMSystem.FloatingObjects["a"] });

            for (int i = 0; i < 100; i++)
            {
                _testFltObjectsWorld.AddAt(aSet, aBox.RandomPoint());
            }

            var cBox = new Box3D(new Point3D(-5.87, -8.09, -0.5), new Point3D(-5.37, -7.59, -0.01));
            var cSet = new NamedMultiset(new[] { _testMSystem.FloatingObjects["c"] });

            for (int i = 0; i < 100; i++)
            {
                _testFltObjectsWorld.AddAt(cSet, cBox.RandomPoint());
            }

            _testFltObjectsWorld.FinalizeStep(true);

            for (int i = 2; i < 4; i++)
            {
                var result = _testFltObjectsWorld.GetNearObjects(testTile.Connectors[i], v_InfiniteMultiset);
                Assert.AreEqual(100, result.Count(obj => obj.Name == "a"));
                Assert.AreEqual(102, result.Count(obj => obj.Name == "c"));
                // TODO low priority t2 extra objects were created during ADD of tiles but generally they need not be there
                // add different floating objects to the test xml file and use them instead of "a","c"
            }
        }
示例#2
0
 public void TestAddNullTile()
 {
     m_tilesWorld.Add(null, null, out newlyCreatedTile);
 }