示例#1
0
        public void FloodFillTest3()
        {
            var actual = new Volume3D <byte>(3, 3, 3);

            // X X X
            // X 0 X
            // X X X
            for (var i = 0; i < actual.Length; i++)
            {
                actual[i] = 1;
            }

            actual[1, 1, 0] = 0;
            actual[1, 1, 1] = 0;
            actual[1, 1, 2] = 0;

            var expected = actual.Copy();

            expected[1, 1, 0] = 1;
            expected[1, 1, 1] = 1;
            expected[1, 1, 2] = 1;

            actual.FillHoles();

            CollectionAssert.AreEqual(expected.Array, actual.Array);
        }
示例#2
0
        public void FloodFillTest3D()
        {
            var actual = new Volume3D <byte>(3, 3, 3);

            // 0 X 0
            // X 0 X
            // 0 X 0
            for (int i = 0; i < 3; i++)
            {
                actual[1, 0, i] = 1;
                actual[0, 1, i] = 1;
                actual[2, 1, i] = 1;
                actual[1, 2, i] = 1;
            }

            var expected = actual.Copy();

            expected[1, 1, 0] = 1;
            expected[1, 1, 1] = 1;
            expected[1, 1, 2] = 1;

            actual.FillHoles();

            CollectionAssert.AreEqual(expected.Array, actual.Array);
        }