I have some question about quarternion rotation. Suppose when I rotate the object, each time I get the angle in quarternion axis-angle form. Now I want the object back to its initial position. How can I add up all the quarternion angle-axis? Because I need to add up all the angular rotation and then rotate the current object to the negative of that angle to come back to the initial position. Any suggestion will be highly appreciated.
To combine the rotation of two quaternions just multiply them.
totalRotation = A * B * C * D;
// restore the original orientation
I don’t suggest this approach cause is error prone, combining a lot of rotation can lead to floating point approximation error.
a better approach is
originalRotation = object.getRotation();
//restor the rotation
I could be wrong here, but isn’t
totalRotation = D * C * B * A;
P.rotated(qa) ==> P’ = qa * P * qa(-1)
P" = qb * (qa * P * qa(-1)) * qb(-1) ==
(qb * qa) * P * (qa(-1)qb(-1)) ==
(qb * qa) * P * (qbqa)(-1)
ups… you are right.
Thank you very much for your reply. It helped a lot in understanding the thing.