Пример #1
0
        // Public Methods (12) 

        /// <summary>
        /// Set the values to the result of an AND operation with grid bt
        /// </summary>
        /// <param name="bt"></param>
        public void And(BitGrid3D bt)
        {
            if (bt.Count != Count)
            {
                throw new Exception("Grids are of different sizes");
            }

            for (var i = 0; i < Count; i++)
            {
                SetValue(i, GetValue(i) && bt.GetValue(i));
            }
        }
Пример #2
0
        /// <summary>
        /// Set values to the result of an OR operation with grid bt
        /// </summary>
        /// <param name="bt"></param>
        public void Or(BitGrid3D bt)
        {
            if (bt.Count != Count)
            {
                throw new Exception("Grids are of different sizes");
            }

            for (var idx = 0; idx < Count; idx++)
            {
                SetValue(idx, GetValue(idx) || bt.GetValue(idx));
            }
        }
Пример #3
0
        /// <summary>
        /// Set the result to be the result of a subtraction with grid bt
        /// </summary>
        /// <param name="bt"></param>
        public void Subtract(BitGrid3D bt)
        {
            if (bt.Count != Count)
            {
                throw new Exception("Grids are of different sizes");
            }

            for (var i = 0; i < Count; i++)
            {
                if (this[i] && bt[i])
                {
                    this[i] = false;
                }
            }
        }