Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose you have an arbitrary quaternion - call it A - how do you rotate it by 180 degrees?

Is there a way to do this without convert to angle-axis representation, i.e., keep it within the quaternion algebra?

share|cite|improve this question

migrated from May 15 '11 at 12:37

This question came from our site for professional and enthusiast programmers.

I don't know what you mean with rotate a quaternion (which actually represents a rotation). But I guess you mean concatenate two quternions with one being a 180 degree rotation about some axis. In this case you can just use the quternion multipication for concatenating two rotations (There is rarely a case where you need to convert them to axis-angle representation). The quaternion for a 180 degree rotation about axis (x,y,z) is just (0,x,y,z).

share|cite|improve this answer
So, an 180 degree rotation about y is just (0,0,1,0) ? So I would just multiply that by my existing rotation? – ina May 16 '11 at 2:16
Yes, that should work. Just remember axis/angle rotation (a,x,y,z) is equal to quaternion (cos(a/2),xsin(a/2),ysin(a/2),z*sin(a/2)). – Christian Rau May 16 '11 at 11:53
But remember the order of multiplication. The one on the right is applied first when rotating a vector by the new quaternion. So (0,0,1,0) * q should do what you want. – Christian Rau May 16 '11 at 11:56
@ina So was it of any help? If yes, up-voting (and maybe accepting) would be appreciated. – Christian Rau Aug 22 '11 at 17:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.