View Full Version : Question about quarternion rotation
07-07-2010, 06:27 AM
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.
07-07-2010, 06:59 AM
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
07-07-2010, 09:21 AM
I could be wrong here, but isn't
totalRotation = D * C * B * A;
07-07-2010, 01:58 PM
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 * (qb*qa)(-1)
ups.. you are right. :D
07-08-2010, 06:09 AM
Thank you very much for your reply. It helped a lot in understanding the thing.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.