예제 #1
0
        static Grid3D()
        {
            var xOffsets = new Location3D[3];
            var yOffsets = new Location3D[3];
            var zOffsets = new Location3D[3];

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

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

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

            neighborOffsets = offsets.ToArray();
        }
예제 #2
0
 public Grid3D(Grid3D <T> other, Location3D dimensions, Location3D 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++)
             {
                 this[offset + (x, y, z)] = other.Values[x, y, z];
예제 #3
0
 protected Grid3D(Location3D dimensions, T defaultValue, bool initializeValueCounters)
     : this(dimensions.X, dimensions.Y, dimensions.Z, defaultValue, initializeValueCounters)
 {
 }
예제 #4
0
 public Grid3D(Location3D dimensions)
     : this(dimensions.X, dimensions.Y, dimensions.Z, default)
 {
 }