示例#1
0
        // Faster equivalent of approachSlow()
        private Cell approach(ChildType direction, int levels)
        {
            if (levels == 0)
            {
                return(this);
            }
            if (index < 2)
            {
                throw new ArgumentException("Cannot find child of a polar cell");
            }
            var a = (uint)Misc.IntPow(3, (uint)levels);

            return(new Cell(this.index * a - (uint)((5 * (4 << (2 * this.Level)) * (a - (1 << (2 * levels))) - ((byte)direction - 4) * (a - 1)) / 2)));
        }