-1

I need to rotate quaternion -90 degree around Y-axis. So, I am using https://stackoverflow.com/questions/4436764/rotating-a-quaternion-on-1-axis for it. Now I have below case,

I am getting multiplication of two quaternion Q1 and Q2 instead of seprate Q1 and Q2. So, Now how to rotate this multiplied quaternion.

As what I want is Q1-rotated * Q2-rotated but I am getting Q1 * Q2, which I can do is ((Q1 * Q2)-rotated) which is not right. As I can't change order of multiplication in quaternion i.e. Q1 * Q2 != Q2 * Q1, which means (Q1*rotation) * (Q2*rotation) != (Q1*Q2) * (rotation*rotation).

So basically I am having Q1 * Q2 and I want Q1-rotated * Q2-rotated where I know rotation.

Please suggest some way to solve this.

Update

I have result of (Q1 * Q2) and unit_rotating_quaternion and I want is (Q1*unit_rotating_quaternion) * (Q2*unit_rotating_quaternion), So Is there any way to find it ?

  • If you only have $Q1Q2$ then you can not* get $Q1$ and $Q2$ from the product. – Somos Nov 26 '19 at 17:35
  • Yes that's true, but Is there any quaternion exist like, (Q1 * Q2) * unit_rotating_quaternion * some_quaternion_to_multiply which will give same result as (Q1unit_rotating_quaternion) (Q2*unit_rotating_quaternion). – Pruthvesh Pipaliya Nov 27 '19 at 04:47

1 Answers1

1

If $p$ is a unit rotating quaternion and $q$ is quaternion to be rotated, then $$ q'= pqp^{-1}. $$

You have $Q=q_1q_2$ and $q'_1=pq_1p^{-1}$, $q_2' = pq_2p^{-1}$, so: $$ Q'=q'_1q_2'=pq_1p^{-1}pq_2p^{-1} = pq_1q_2p^{-1} = pQp^{-1} $$ as expected.

Vasily Mitch
  • 10,129
  • Your answer helped me for understanding clearly. But If I rotate (Q1Q2) using unit rotating quaternion and after that If I am finding difference between (Q1-rotatedQ2-rotated) and (Q1Q2)-rotated using diff = q2 inverse(q1)** then I am getting difference of x=-0.7071, y=0.0, z=0.7071, w=0 sometimes this diff is changing as x=0.7071, y=0.0, z=-0.7071, w=0. Can you help me out with this. – Pruthvesh Pipaliya Nov 26 '19 at 15:02
  • I don't understand the question. Sorry – Vasily Mitch Nov 26 '19 at 15:05
  • As per your answer I understood, If I want Q1-rotated * Q2-rotated from Q1*Q2 than I can directly multiply unit rotation quaternion to Q1*Q2. In such case If I find difference using formula diff = (Q1-rotated * Q2-rotated) * inverse((Q1Q2)rotated) must not come as x=-0.7071, y=0.0, z=0.7071, w=0 which I am getting and also diff is sometimes changing to x=0.7071, y=0.0, z=-0.7071, w=0. So I might be doing something wrong in this. Can you please help me understanding how I am getting difference in this? – Pruthvesh Pipaliya Nov 26 '19 at 15:10
  • I still cant understand what you are doing. What problem are you trying to solve? What are Q1 and Q2? Why do you need to rotate them? Why do you need to take the diff? It will help if you first consider carefully everything you are trying to achieve (draw pictures), and then formulate your question. We cant debug the equations for you. – Vasily Mitch Nov 26 '19 at 15:17
  • I also know you will not debug for me. Anyway you proved associativity. What question I asked is different, In which I know multiplication of two quaternion Q1 & Q2. And I want to find Q1-rotated * Q2-rotated. If I know Q1 & Q2 separately than I will do like Q1unit_rotating_quaternion Q2*unit_rotating_quaternion but I have (Q1 * Q2) so If I do (Q1 * Q2) * unit_rotating_quaternion that will not give me what I want. So I am taking difference just for checking, if it is giving result what I want to do or not. – Pruthvesh Pipaliya Nov 27 '19 at 04:43