≈ the.bay.news

How to slice a 3-dimensional array

The Rust Programming Language Forum
How to slice a 3-dimensional array
I have a three-dimensional array like this: const XDIM = 60; const YDIM = 60; const ZDIM = 2; let mut world = [[[0.0; ZDIM] ; YDIM]; XDIM]; How would I extract all the X and Y contents for a single Z-value, giving me something like a variable of the type [[f64; YDIM] ; XDIM] Would it be easier/possible to reorganize the array so the z-axis is on the outside and I can slice it like let mut world = [[[0.0; YDIM] ; XDIM]; ZDIM]; let z = 0; let slice = world[z]; Thanks! :3

I have a three-dimensional array like this: const XDIM = 60; const YDIM = 60; const ZDIM = 2; let mut world = [[[0.0; ZDIM] ; YDIM]; XDIM]; How would I extract all the X and Y…

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.