# Makie: rotating HyperRectangles?

Hi
For my masters thesis I’m trying to write a very basic physics engine,
and since Makie is the only package that seems to do graphics in Julia,
I want to use it to handle the visualisation of simple moving objects in 3D (mainly hyperrectangles).
Yet I can’t seem to find a way to do something simple as rotating a hyperrectangle,
am I missing something? I’ve looked into using a mesh, but I was wondering if there isn’t a nicer way.

Fast batch drawing:

``````using Makie

N = 100

meshscatter(
Point3f0.(rand.() .* 4, rand(N) .* 4, rand.() .* 0.01),
markersize = Vec3f0.(rand.() .* 0.3, rand.() .* 0.3, rand(N)),
marker = FRect3D(Vec3f0(0), Vec3f0(1)),
color = rand(RGBf0, N),
rotations = Vec3f0.(rand(N) .* 0.3, rand.() .* 0.8, 1) # also accepts Quaternions
)
``````

``````
using Makie
N = 100
scene = mesh(
FRect3D(Vec3f0(-0.5), Vec3f0(1)), color = :skyblue2,
)
rect = scene[end] # last plot is the rect
# there are a couple of ratate! functions, that accept e.g. a vector etc
rotate!(rect, Quaternionf0(0, 0.4, 0, 1))
scene
``````

If this works for you, you could consider adding this to the Makie examples so that the next person has an easier time https://github.com/JuliaPlots/Makie.jl/blob/master/examples/examples3d.jl#L599

4 Likes

I get

``````scene = mesh(
FRect3D(Vec3f0(-0.5), Vec3f0(1)), color = :skyblue2,
)
Error showing value of type Scene:
ERROR: MethodError: no method matching _default(::Observables.Observable{GeometryTypes.HomogenousMesh{Point{3,Float32},GeometryTypes.Face{3,GeometryTypes.OffsetInteger{-1,UInt32}},GeometryTypes.Normal{3,Float32},Nothing,ColorTypes.RGBA{Float32},Nothing,Nothing}}, ::Makie.GLMakie.GLAbstraction.Style{:default}, ::Dict{Symbol,Any})
Closest candidates are:
_default(::GeometryTypes.HomogenousMesh{Point{3,Float32},GeometryTypes.Face{3,GeometryTypes.OffsetInteger{-1,UInt32}},GeometryTypes.Normal{3,Float32},Nothing,ColorTypes.RGBA{Float32},Nothing,Nothing}, ::Makie.GLMakie.GLAbstraction.Style, ::Dict) at /Users/michael/.julia/dev/Makie/src/glbackend/GLVisualize/visualize/mesh.jl:49
_default(::AxisArrays.AxisArray{T,3,D,Ax} where Ax where D, ::Makie.GLMakie.GLAbstraction.Style, ::Dict) where T at /Users/michael/.julia/dev/Makie/src/glbackend/GLVisualize/visualize/image_like.jl:138
_default(::Union{Observable{T<:(AxisArray{T,2,D,Ax} where Ax where D where T)}, T<:(AxisArray{T,2,D,Ax} where Ax where D where T)}, ::Makie.GLMakie.GLAbstraction.Style, ::Dict) where T<:(AxisArrays.AxisArray{T,2,D,Ax} where Ax where D where T) at /Users/michael/.julia/dev/Makie/src/glbackend/GLVisualize/visualize/image_like.jl:154
``````

on master with this

pfew, I guess I merged to much to master lately without tests, since I currently need to run them locally did you make sure, to synchronize AbstractPlotting & Makie on master?

Aaaahh! I got hit by the “`dev`ed packages aren’t touched” Pkg3 behaviour! It looks like you’re tracking master (if you don’t check the path of the package), but it’s your local master. `free` and `add #master` resolved this. Sorry for the noise.

thank you so much!