public void TestContains() { var tree = new QuadTree <TreeItem>(new Rectangle(0, 0, 50, 50)); var i = new TreeItem(new Rectangle(0, 0, 3, 3)); var j = new TreeItem(new Rectangle(20, 20, 40, 40)); var k = new TreeItem(new Rectangle(15, 2, 4, 6)); tree.Add(i); tree.Add(j); Assert.IsTrue(tree.Contains(i)); Assert.IsTrue(tree.Contains(j)); Assert.IsFalse(tree.Contains(k)); }
public void TestRemoveBug() { var tree = new QuadTree <TreeItem>(new Rectangle(0, 0, 10, 10), 1); var i = new TreeItem(new Rectangle(0, 0, 3, 3)); var j = new TreeItem(new Rectangle(0, 0, 2, 2)); tree.Add(i); tree.Add(j); var success = tree.Remove(j); Assert.IsTrue(success); Assert.AreEqual(1, tree.Count); Assert.IsTrue(tree.Contains(i)); Assert.IsFalse(tree.Contains(j)); }
public void AddAPointAssertExists() { var ut = new QuadTree(Bounding2DBox.Max, 10, new SimpleQuadTreeDivisionStrategy()); ut.Add(Point2Int.Zero); Assert.IsTrue(ut.Contains(Point2Int.Zero)); }
public void ThenIExpectTheQuadTreeToContainTheFollowingPoints(Table table) { var points = table.GetPoints(); foreach (var vector2Int in points) { var isContained = _quadTree.Contains(vector2Int); Assert.IsTrue(isContained); } }
public void TestInsert() { var tree = new QuadTree <TreeItem>(new Rectangle(0, 0, 50, 50)); Assert.AreEqual(0, tree.Count); var i = new TreeItem(new Rectangle(0, 0, 3, 3)); tree.Add(i); Assert.IsTrue(tree.Contains(i)); Assert.AreEqual(1, tree.Count); }