Пример #1
0
        public void ShouldGetWorstCouple()
        {
            var nodeStrategy = new GuttmanSplit <Int32>();

            var elemets = new List <Shape2DItem <Int32> >()
            {
                Shape2DFactory.GetShape(0, 0, 10, 10),
                Shape2DFactory.GetShape(15, 10, 10, 10),
                Shape2DFactory.GetShape(30, 0, 10, 10),
                Shape2DFactory.GetShape(75, 0, 10, 10),
                Shape2DFactory.GetShape(45, 0, 10, 10),
                Shape2DFactory.GetShape(60, 0, 10, 10),
            };

            var worstCouple = nodeStrategy.GetWorstCouple(elemets);

            Assert.AreEqual(0, elemets.ElementAt(worstCouple.IndexA).BoundingBox2D.X);
            Assert.AreEqual(75, elemets.ElementAt(worstCouple.IndexB).BoundingBox2D.X);
        }
Пример #2
0
        public void ShouldAdd7Elements()
        {
            var elemets = new List <Shape2DItem <Int32> >()
            {
                Shape2DFactory.GetShape(0, 0, 10, 10),
                Shape2DFactory.GetShape(15, 0, 10, 10),
                Shape2DFactory.GetShape(30, 0, 10, 10),
                Shape2DFactory.GetShape(45, 0, 10, 10),
                Shape2DFactory.GetShape(60, 0, 10, 10),
                Shape2DFactory.GetShape(75, 0, 10, 10),
            };

            var tree = new RTree <Int32>();

            foreach (var item in elemets)
            {
                tree.Add(item);
            }

            Debug.WriteLine(tree.ToString());

            Assert.Fail();
        }