예제 #1
0
        public void TestClear()
        {
            PartitionFieldTree <Rect> fieldTree = new PartitionFieldTree <Rect>(10, 10);

            Rect rect1 = new Rect(new Point(2, 2), new Size(3, 3));
            Rect rect2 = new Rect(new Point(-2, 2), new Size(1, 1));
            Rect rect3 = new Rect(new Point(3, 2), new Size(1, 2));
            Rect rect4 = new Rect(new Point(2, -2), new Size(1, 1));

            fieldTree.Add(rect1);
            fieldTree.Add(rect2);
            fieldTree.Add(rect3);
            fieldTree.Add(rect4);
            fieldTree.Clear();
            Assert.AreEqual(fieldTree.IsEmpty(), true);
        }
예제 #2
0
        public void AddSingleRectangle()
        {
            PartitionFieldTree <Rect> fieldTree = new PartitionFieldTree <Rect>(10, 10);

            Rect rect1 = new Rect(new Point(2, 2), new Size(3, 3));

            fieldTree.Add(rect1);
            Assert.AreEqual(fieldTree.IsEmpty(), false);
        }
예제 #3
0
        public void AddSingleRectangleAndPop()
        {
            PartitionFieldTree <Rect> fieldTree = new PartitionFieldTree <Rect>(10, 10);

            Rect rect1 = new Rect(new Point(2, 2), new Size(3, 3));

            fieldTree.Add(rect1);
            Rect r = fieldTree.PopNearestObject(0, 0);

            Assert.AreEqual(fieldTree.IsEmpty(), true);
            Assert.AreEqual(r, rect1);
        }