Closed empet closed 3 years ago
Hi @empet !
No, the product q * v
is defined here as the product of q * Quaternion(0, v)
. The latter is a quaternion with real part 0 and vector part equal to v
. The real part will be 0 if you use quaternions to rotate a vector like inv(q) * v * q
or q \ v * q
.
julia> using ReferenceFrameRotations
julia> q = Quaternion(cos(π/6), 0, 0, sin(π/6))
Quaternion{Float64}:
+ 0.866025 + 0.0⋅i + 0.0⋅j + 0.5⋅k
julia> v = [3, -1.5, -0.354];
julia> q \ v * q
Quaternion{Float64}:
+ 0.0 + 0.200962⋅i - 3.34808⋅j - 0.354⋅k
Notice that the way I defined the multiplication between vectors and quaternions is not the same as in other packages. It is more close to the mathematical definition. Does it make sense?
I was confused by multiplication in Rotations.jl. There q=UnitQuaternion(cos(π/6), 0, 0, sin(π/6) is in fact the rotation matrix with pi/3 about zaxis, and the product q*v is the result of rotation. Thank you!
The product of a unit quaternion and a vector has non-zero real part. By product definition it must be zero.
Julia 1.6.1, ReferenceFrameRotations.jl, v 1.0.1