How to use a quaternion in Makie.rotate?


Extracted from the doc of Makie:

rotate!(t::Transformable, axis_rot::Quaternion)
rotate!(t::Transformable, axis_rot::AbstractFloat)
rotate!(t::Transformable, axis_rot...)

Not very clear to me.

How do we specify a quaternion? Does it require a package?

Looks like it is defined in Makie.

julia> using Makie

julia> Quaternion(1,2,3,4)
4 + 1im + 2jm + 3km

julia> using LinearAlgebra

julia> normalize(rand(Quaternion))
0.8191226636248707 + 0.40652219207787577im + 0.19333957116552272jm + 0.35552437259044173km
1 Like