1
votes

The following is the representation for rotating about a unit quaternion {q0,q1,q2,q3} by an angle alpha:

q_0=cos(alpha/2)
q_1=sin(alpha/2)cos(beta_x)
q_2=sin(alpha/2)cos(beta_y)
q_3=sin(alpha/2)cos(beta_z)

Here,beta_x, beta_y and beta_z are the direction cosines of the unit quaternion, i.e. the axis about which I am rotating.

The rotation matrix corresponding to this is as follows: Let's call this R1

 1- 2(q_2^2 + q_3^2)   2(q_1 q_2 - q_0 q_3)    2(q_0 q_2 + q_1 q_3) 
2(q_1 q_2 + q_0 q_3)   1 - 2(q_1^2 + q_3^2)    2(q_2 q_3 - q_0 q_1) 
2(q_1 q_3 - q_0 q_2)   2( q_0 q_1 + q_2 q_3)   1 - 2(q_1^2 + q_2^2)

Now, suppose my rotation matrix is represented by using Euler angles instead: Let's call this R2

enter image description here

R2 rotates a vector by phi around x axis first, then by theta around the y axis and finally by psi around the z axis. Now, suppose my axis of rotation is in the y-z plane.This means that there is no rotation around the x-axis, only a combination of rotations around the y and z axes. This means that phi is zero, which means that R2(3,2) is zero.

Alternatively, this also means that cos(beta_x) is zero, since there is no rotation about the x-axis.This means that q_1 is zero.However, if we look at R1(3,2), it is not zero, unlike R2(3,2).Why are these two representations not the same? What am I missing?

1
TL;DR Most likely you run into the so-called double cover issue, see for example Incorrect conversion from quaternions to euler angles and back. Please check.Ali
@Ali: Thanks for the reply! I'm stuck in a problem where I have to rotate an object by an arbitrary angle around an axis confined to the y-z plane and then find out the Euler angles which produced this.It is absolutely necessary that i only find the Euler angle set which has rotations about the y and z axis only. To do this, I am equating R1 and R2 and trying to solve for theta and psi, assuming phi is zero. How do you suggest I proceed with this condition in mind?Ananth Saran
OK, now I have also read the question. So you suspect that you made somewhere and error during the derivation of the formulas? In any case, I believe this question belongs to math.stackexchange.com You probably have a better luck there than here. Sorry I couldn't be more helpful...Ali
@Ali: I just took the formulas out of this page:en.wikipedia.org/wiki/…Ananth Saran

1 Answers

0
votes

This statement is wrong.

Now, suppose my axis of rotation is in the y-z plane.This means that there is no rotation around the x-axis, only a combination of rotations around the y and z axes. This means that phi is zero, which means that R2(3,2) is zero.

For a rotation about (0,.6,.8), R2(3,2) would be
(1-cos)(.6)(.8)
See here
I'd like to work on a visualization of this.

EDIT: Going here and entering Axis-angle of (0,.6,.8) and angle of 45 degrees gives R2(3,2) = .1406 as expected, and it gives the Euler angles.

EDIT 2: SEVEN YEARS AGO?! How did this appear on my computer?