public static Volume <T> ToVolume <T>(this Shape shape) where T : struct, IEquatable <T>, IFormattable
        {
            var builder = BuilderInstance <T> .Create();

            var vol = builder.From(new[] { ToT <T>(shape.GetDimension(0)), ToT <T>(shape.GetDimension(1)), ToT <T>(shape.GetDimension(2)), ToT <T>(shape.GetDimension(3)) },
                                   new Shape(4));

            return(vol);
        }
Exemple #2
0
        public Volume <T> ReShape(Shape shape)
        {
            var guessedShape = new Shape(shape);

            for (int i = 0; i < shape.DimensionCount; i++)
            {
                if (shape.GetDimension(i) == Shape.Keep)
                {
                    guessedShape.SetDimension(i, this.Shape.GetDimension(i));
                }
            }
            guessedShape.GuessUnkownDimension(this.Shape.TotalLength);

            Volume <T> .Count--;

            return(BuilderInstance <T> .Volume.Build(this.Storage, guessedShape));
        }