Rotating cube in Makie not working

Hello,

I just found this example of a cube that should be rotating link:


using Makie
 
N = 40
interval = 0.10
 
scene = mesh(FRect3D(Vec3f0(-0.5), Vec3f0(1)), color = :skyblue2)
rect = scene[end]
 
for rad in 0.5:1/N:8.5
    arr = normalize([cospi(rad/2), 0, sinpi(rad/2), -sinpi(rad/2)])
    rotate!(rect, Quaternionf0(arr[1], arr[2], arr[3], arr[4]))
    sleep(interval)
end

However, when I run the code, I got UndefVarError : normalize not defined.
Does the normalize function still exist inside other package ?

And for curiosity, if I want to perform a rotation using similar syntax of Plots package, with camera = (azimuth, elevation), is there any simple conversion from angles into quartenions to use with Makie ?

Thank you :heart:

1 Like

It’s part of the LinearAlgebra package, so you need to use that too.

1 Like