Last active
May 27, 2019 00:30
-
-
Save briochemc/6fa8f3b8e5be2df14f86ad6a7a2b7b4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Makie | |
using GeometryTypes | |
wet3d = falses(2, 2, 2) | |
wet3d[[1, 2, 3, 5, 6]] .= true | |
shoebox3d = permutedims(wet3d, [2, 1, 3]) | |
mycolor(x) = x ? RGBAf0(0,0,1,0.4) : RGBAf0(0.5,0.5,0,1) | |
Ind = CartesianIndices(size(shoebox3d)) | |
myorigin(i) = Vec3f0((Ind[i].I) .* (1, 1, -1) .- (1, 1, 0)) | |
mycube(x, i) = HyperRectangle(myorigin(i), Vec3f0(0.99,0.99,0.99)) | |
mytext(i) = text(string(i), position = myorigin(i) .+ 1) | |
rectangles = vec([(mycube(x, i), mycolor(x)) for (i, x) in enumerate(shoebox3d)]) | |
# create an array of differently colored boxes in the direction of the 3 axes | |
meshes = map(GLNormalMesh, rectangles) | |
mesh(merge(meshes)) | |
#[mytext(i) for (i, x) in enumerate(shoebox3d)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment