Makie: Draw two meshes in one scene: Struggling with positioning

I tried to draw two boxes in one scene. Both should be centered, but it appears, that there is something else going on:

using Makie
scene = mesh(Rect3D(((1,1,0), (-1,-1,0.1))), color = "green")
mesh!(scene, Rect3D(((.25,.25,0), (-.25,-.25,0.11))), color = "yellow")

I’d like the yellow mesh to be in the center of the green one.
Am I right in the assumtion, that Rect3D(((1,1,0), (-1,-1,0.1))) draws a box from (1,1,0) to (-1,-1,0.1)?

1 Like

If you assume, that it is not draw box from-to, but draw a box with start-coordinates and 3 length values of the edges it would be for your values:

julia> scene = mesh(Rect3D(((-1,-1,0), (2,2,0.1))), color = "green")
julia> mesh!(scene, Rect3D(((-.25,-.25,0), (0.5,0.5,0.11))), color = "yellow")

Bit I didn’t look for details, just tried it.

1 Like