Пример #1
0
        static Grid4D()
        {
            var xOffsets = new Location4D[3];
            var yOffsets = new Location4D[3];
            var zOffsets = new Location4D[3];
            var wOffsets = new Location4D[3];

            for (int i = -1; i <= 1; i++)
            {
                xOffsets[i + 1] = (i, 0, 0, 0);
                yOffsets[i + 1] = (0, i, 0, 0);
                zOffsets[i + 1] = (0, 0, i, 0);
                wOffsets[i + 1] = (0, 0, 0, i);
            }

            var offsets = new List <Location4D>(3 * 3 * 3 * 3);

            foreach (var xOffset in xOffsets)
            {
                foreach (var yOffset in yOffsets)
                {
                    foreach (var zOffset in zOffsets)
                    {
                        foreach (var wOffset in wOffsets)
                        {
                            offsets.Add(xOffset + yOffset + zOffset + wOffset);
                        }
                    }
                }
            }

            neighborOffsets = offsets.ToArray();
        }
Пример #2
0
 public Grid4D(Grid4D <T> other, Location4D dimensions, Location4D offset)
     : this(dimensions, default, false)
 {
     for (int x = 0; x < other.Width; x++)
     {
         for (int y = 0; y < other.Height; y++)
         {
             for (int z = 0; z < other.Depth; z++)
             {
                 for (int w = 0; w < other.DepthW; w++)
                 {
                     this[offset + (x, y, z, w)] = other.Values[x, y, z, w];
Пример #3
0
 protected Grid4D(Location4D dimensions, T defaultValue, bool initializeValueCounters)
     : this(dimensions.X, dimensions.Y, dimensions.Z, dimensions.W, defaultValue, initializeValueCounters)
 {
 }
Пример #4
0
 public Grid4D(Location4D dimensions)
     : this(dimensions.X, dimensions.Y, dimensions.Z, default)
 {
 }