How do you get the facing of a D3DXQUATERNION?

Started by
2 comments, last by Funkymunky 17 years, 7 months ago
I thought quaternions fully described orientation in 3d space, but I haven't been able to figure out how to get the direction it's facing. Am I way off here? I see how to transform a vector by a quaternion with D3DXVec3TransformCoord, do I need to keep track of the direction seperately? That would suck =/ Not much of a DirectX question but (if possible) I'd like to confine myself to the D3DX family of math functions for the time being.
Advertisement
Quaternions don't face a direction. Quaternion is just a construct, a set of numbers. It can be interpreted as a rotation description. But I've yet to see it interpreted as a "direction".

Quaternion is an extention of angle in 2D - to 3D. You don't ask of a direction of an angle => you don't ask of a direction of a quaternion. A quaternions doesn't describe orientation - it describes a rotation of some base orientation. In order to ask of a final orientation (after being rotated) you've got to answer the question -> "what's your base orientation?".


I figure you're asking of the outcome of vector (0,0,1) transformed by a quaternion. Is that right?
Quote:Original post by deffer
Quaternions don't face a direction. Quaternion is just a construct, a set of numbers. It can be interpreted as a rotation description. But I've yet to see it interpreted as a "direction".

Quaternion is an extention of angle in 2D - to 3D. You don't ask of a direction of an angle => you don't ask of a direction of a quaternion. A quaternions doesn't describe orientation - it describes a rotation of some base orientation. In order to ask of a final orientation (after being rotated) you've got to answer the question -> "what's your base orientation?".


I figure you're asking of the outcome of vector (0,0,1) transformed by a quaternion. Is that right?


I guess I didn't really know what I was asking. So a quaternion can fully describe orientation if I combine it with a base orientation like (0,0,1)? Why would you pick that particular one?

Oh, that would be the up vector normally passed to 3DXMatrixLookAtLH!
generally when you want to translate something "forward" you do it in the positive z direction. That's entirely arbitrary and dependant on the coordinate system you're using.

Quaternion * Vector effectively rotates the vector according to the quaternion, so if positive z is "forward" then multiplying (0, 0, 1) by your quaternion will effectively give you the direction it's facing

This topic is closed to new replies.

Advertisement