更新时间:2022-05-05 00:37:45
算法大致相同.如果你有一个 3D 数组 Original[HEIGHT, WIDTH, DEPTH]
那么你可以把它变成 Flat[HEIGHT * WIDTH * DEPTH]
by
The algorithm is mostly the same. If you have a 3D array Original[HEIGHT, WIDTH, DEPTH]
then you could turn it into Flat[HEIGHT * WIDTH * DEPTH]
by
Flat[x + WIDTH * (y + DEPTH * z)] = Original[x, y, z]
顺便说一句,在 .NET 中,您应该更喜欢数组数组而不是多维数组.性能差异显着
As an aside, you should prefer arrays of arrays over multi-dimensional arrays in .NET. The performance differences are significant