I'm trying to understand Quaternions in relation to rotation and orientation.
As an example in learning, I'm trying to rotate a point (e.g. at [0.7071, 0, -0.7071], on the unit sphere) about the line x=z (or the vector [0.7071, 0, 0.7071] for a unit vector pointing in x/z direction. It should rotate around the unit sphere, passing through [0,1,0]
I've read that "multiple rotations are just multiplication", but if that's the case, why are the following are not equivalent?
# This version does what I want, rotates a point about the line x=z
val q = Quaternion().setAngleAxis(toRadians(45), 0.7071, 0, 0.7071)
# neither of the following multiplications produce the equivalent to the above q
val qx = Quaternion().setAngleAxis(toRadians(45), 1, 0, 0)
val qy = Quaternion().setAngleAxis(toRadians(45), 0, 1, 0)
val q1 = qx.mul(qy)
val q2 = qy.mul(qx)
(My reasoning is like looking at a unit vector starting in the x direction, which if I rotate 45 degrees in the y axis would give me a vector pointing in the z=x direction, but this is clearly naive as it doesn't work)
An example plot of qx * qy (but using 5 degree rotations instead of 45) is:
The q rotation I want gives me:
My understanding is qx and qy represent rotations about the given axis, or indeed also represent orientations, and if I use these independently and plot them, I get what I would expect, a point being rotated as required.
But if I start from either one of these, why doesn't the multiplication of the other (which represents an initial orientation multiplied by a rotation) result in a rotation that would rotate a point by both the x and the y axis?
Which leads me to the question, what does qx * qy (or vica verca) represent here? (I think this is the key bit I'm not understanding.)
Is it possible to apply something to qx or qy to get the original q directly?