Skip to content

Instantly share code, notes, and snippets.

@briochemc
Last active May 27, 2019 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briochemc/6fa8f3b8e5be2df14f86ad6a7a2b7b4f to your computer and use it in GitHub Desktop.
Save briochemc/6fa8f3b8e5be2df14f86ad6a7a2b7b4f to your computer and use it in GitHub Desktop.
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)]
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment