Esempio n. 1
0
        public static IEnumerable <Cube> Parse(ReadOnlyMemory <string> input)
        {
            var size   = input.Length;
            var offset = -(size / 2);

            for (int x = 0; x < size; x++)
            {
                var line = input.Span[x];

                for (int y = 0; y < size; y++)
                {
                    var c = line[y];

                    if (c == '#')
                    {
                        var position = new PositionXYZ {
                            X = offset + x, Y = offset + y
                        };
                        yield return(new Cube(position)
                        {
                            Active = true
                        });
                    }
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="positionCount"></param>
        /// <param name="pointsCount"></param>
        /// <returns></returns>
        public MatrixXYZ <T> CreateMatrixXYZ(int positionCount, params int[] pointsCount)
        {
            var positions = new PositionXYZ <T> [positionCount];

            for (int i = 0; i < positionCount; ++i)
            {
                positions[i] = _positionFactory.CreatePositionXYZ(pointsCount[i]);
            }
            return(new MatrixXYZ <T>(positions));
        }