Why is the result of quaternion rotation an matrix multiplication not the same

6 views (last 30 days)
Hi guys,
Consider the following:
R = [1,0,0;0,0,-1;0,1,0];
y = [0;1;0];
R*y
quatrotate(rotm2quat(R),[0,1,0])
The results are (in the same order):
(0; 0; 1)
(0, 0, -1)
Why is the result not the same?
I can force it to give the same result if I do
quatrotate(quatinv(rotm2quat(R)),y)
which yields
(0, 0, 1)
Thanks for the help!

Accepted Answer

Jan
Jan on 20 Nov 2016
Edited: Jan on 21 Nov 2016
See https://www.mathworks.com/matlabcentral/answers/155400-why-does-quatrotate-produce-negative-rotations : It is the difference between rotating the coordinates or the reference frame.
  4 Comments
Daniel Schneider
Daniel Schneider on 20 Dec 2016
OK Thanks. That was helpful!
So conclusively:
Let R be a rotation matrix rotating a vector in a fixed frame.
q = rotm2quat( R ).
quatrotate(q,v) will rotate the frame relative to a "fixed" vector v (equivalent to q^-1vq). In order to achieve
r = Rv
either do
qvq^-1
or
quatrotate(quatinv(q),v)
This is not (yet) documented in the MATLAB documentation (at least as we know).

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!