volume <- array(0, dim = c(8,8,8))
volume[4:5, 4:5, 4:5] <- 1
graphics::image(x = volume[4,,])
# you can use rgl::wire3d(mesh) to visualize the mesh
mesh <- mesh_from_volume(volume, verbose = FALSE)
Run the code above in your browser using DataLab