Weird results when adding euler angle rotations using quaternions

To combine the quaternions, try multiplying them.

Sorry for writing about "adding" in context of quaternions. I meant the resulting euler angles should behave as being added; as the quaternions are being multiplied:



From the snippet above:


Quaternion qr = q1.mult(q2);

Are you aware that Quaternion multiplication is not commutative?



q1.mult(q2) != q2.mult(q1)

Yep I know that. Besides, adding to some existing rotation q1 a rotation q2, wouldn't it be done like q1.mult(q2) ?

Anyway, even when trying q2.mult(q1), the numbers are the same, just their order is swapped…

I'm thinking that this is due to a misunderstanding of Euler angles…



read this: http://en.wikipedia.org/wiki/Euler_angles



To be honest I am not too clear on them, but they are not simple representations of x,y,z rotations; for one thing I believe your 'roll' angle is outside the appropriate range. Try setting q1 to 90,90,90 and view the results.

Thanks for the hint. I indeed thought of euler angles as being just rotations about the x,y,z axes.

Apparently I should have had RTFM about euler angles ;D



Again, thanks for the help !