# Quaternion Rotation - Clockwise or Counter-Clockwise?

when we specify a Quaternion as (axis of rotation, rotation amount), in which 'direction' is the rotation, assuming we are looking down the rotation axis (i.e. camera at the origin, looking along the axis vector)?

Does it depend on the handed-ness of the co-ordinate system?

Or is it actually a moot point / stupid question?

It depends on the coordinate system you're working in.

In a right-handed coordinate system (eg. x right, y up, z points toward the viewer), the right-hand rule applies, as mklingen describes in the existing answer.

In a left-handed coordinate system (eg. x right, y up, z points away from the viewer), the left-hand rule applies - you point your left thumb along the rotation axis, and a positive rotation turns in the directions your fingers curl.

So it's important to know what coordinate system you're working with. Unity for instance uses a left-handed coordinate system. 3DS Max uses a right-handed coordinate system. Changing handedness flips the sign of an odd number of axes, and all rotation angles.

"Oh, so Quaternions are basically... 4D vectors, then? That we just give another name?"

Not quite. Like 4-vectors, they are 4-tuples of numbers, but interpreted such that three of the four components are measured in imaginary units. That means that two quaternions multiply together differently than they would if composed of real numbers (because 1i * 1i = -1). This weird multiplication means that they combine like 3D rotations do (something you don't get out-of-the-box with real numbers), which is why we often use them to describe rotations and orientations.

• Thanks DMGregory. I'm using DirectX which is left-handed, so that was a good amendment! Presumably, negating theta when encoding an axial rotation would 'reverse' the clockwise-ness? – Xenoprimate Nov 21 '14 at 17:19
• Correct, multiplying the angle parameter by -1 will change the resulting rotation from clockwise to counterclockwise or vice versa. – DMGregory Nov 21 '14 at 18:33

Quaternions are not axis/rotation vectors. That's just not how they work. They do encode an axis/rotation, but not in the way you describe. Check out the equation from wikipedia:

Given an axis [a_x, a_y, a_z] and angle theta,

q = [a_x * sin(theta / 2), a_y * sin(theta / 2), a_z * sin(theta / 2), cos(theta / 2)]


That said, if you do have an axis/rotation vector, it follows the right hand rule. Looking down the axis of rotation, positive rotations will appear clockwise. Point your right thumb along the axis of rotation. The curl of your fingers is the angular motion of a positive rotation along that axis.

• Oh, so Quaternions are basically... 4D vectors, then? That we just give another name? – Xenoprimate Nov 21 '14 at 16:56