Question about quaternions

Started by
0 comments, last by Zakwayda 17 years, 10 months ago
OK, I've been doing research on quaternions, but I'm still a little confused. I know the format quaternions are represented in is: [ cos(theta / 2), ( sin(theta / 2)x, sin(theta / 2)y, sin(theta / 2)z )] and I've been told they're used like an axis-angle representation of orientation. But let's say I want to represent a rotation of 0 radians along the Z axis, facing in the negative Z direction, like the default in OpenGL, my quaternion comes out to: [ 1, (0, 0, 0) ] and let's say I wanted to rotate to zero degrees along the Y axis facing the negative direction, I can't figure out how to do that. I realize I'm just not getting this, any help appreciated.
Advertisement
Quote:Original post by SpacedOut
OK, I've been doing research on quaternions, but I'm still a little confused. I know the format quaternions are represented in is:

[ cos(theta / 2), ( sin(theta / 2)x, sin(theta / 2)y, sin(theta / 2)z )]
To be a little more accurate, a quaternion is just a mathematical entity; the above rotation form is one interpretation of a quaternion (albeit a common one).
Quote:But let's say I want to represent a rotation of 0 radians along the Z axis, facing in the negative Z direction, like the default in OpenGL, my quaternion comes out to:

[ 1, (0, 0, 0) ]

and let's say I wanted to rotate to zero degrees along the Y axis facing the negative direction, I can't figure out how to do that.

I realize I'm just not getting this, any help appreciated.
There's no such thing as a 'rotation of 0 radians along the Z axis', so you may be a bit confused there.

All rotations can be reduced to a rotation by a single angle about a single axis (the axis-angle form you referred to). In your example, it sounds like you want a rotation that rotates a vector (the forward vector) from the -z to -y axis; the most direct of these is a rotation of -90 degrees about the +x axis (or, equivalently, 90 degrees about the -x axis).

By the way, the use of quaternions is completely incidental in this problem. It might be best to instead think of it in terms of vector, matrix, or axis-angle rotations until you've got the underlying concepts down. Then, you can introduce quaternions if you have some particular need for them.

This topic is closed to new replies.

Advertisement