示例#1
0
        public void FindClosestTest()
        {
            var environment = new Environment(0.2, 0.2, 2.6, 1.6);

            var collective = new BlobCollective(1.0, 1.0, 4);

            collective.Split();
            collective.Split();

            collective.Move(1.0);
            collective.Sc(environment);

            var largest   = collective.FindLargest(null);
            var smallest1 = collective.FindSmallest(null);
            var smallest2 = collective.FindSmallest(smallest1);

            var closest = collective.FindClosest(largest);

            Assert.AreSame(smallest2, closest);
        }
示例#2
0
        public void FindSmallestTest()
        {
            var collective = new BlobCollective(1.0, 1.0, 4);

            collective.Split();
            collective.Split();

            var largest = collective.FindLargest(null);

            // Find one of the two smallest blobs.
            var smallest1 = collective.FindSmallest(null);

            Assert.AreNotSame(largest, smallest1);
            Assert.AreEqual(0.225, smallest1.Radius, 0.01);

            // Find the other smallest blob.
            var smallest2 = collective.FindSmallest(smallest1);

            Assert.AreNotSame(largest, smallest2);
            Assert.AreNotSame(smallest1, smallest2);
            Assert.AreEqual(0.225, smallest2.Radius, 0.01);
        }