Archived

This topic is now archived and is closed to further replies.

Rotation without quats

This topic is 5572 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


Quats are best really as they let you interpolate between a start and finish angle, so you can still easily calculate orientation even if frame rate is a bit bumpy. They also avoid gimble lock, so as far as I know its the best approach. Dunno about tutorials, but google is pretty effective.

Share this post


Link to post
Share on other sites

The DirectX docs in the SDK actually give a clear description of what they are :

Quaternions add a fourth element to the [x, y, z] values that define a three-component-vector. Quaternions are an alternative to the matrix methods that are typically used for 3-D rotations. A quaternion represents an axis in 3-D space and a rotation around that axis. For example, a quaternion might represent a (1,1,2) axis and a rotation of 1 radian. Quaternions carry valuable information, but their true power comes from the two operations that you can perform on them: composition and interpolation.

I.e. they define an axis and rotation magnitude.

I got that from googles cache as its from the Direct X 7 API docs that are no longer up. However I''m sure its in the DX8 docs, so just do some searching. The cached page is linked below :

http://216.239.51.100/search?q=cache:H93TTwyGpJQC:msdn.microsoft.com/library/en-us/dx8_c/hh/dx8_c/graphics_intro_7igj.asp+simple+quaternion+example&hl=en&ie=UTF-8

If you find a good tutorial you should post it here as most of them seem dreadful

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Okay quats are good for some stuff...


But my recomendation is "screw" the quats code and use matrices. I actually think that a simple matrix transformation (resultant from the multiplication of various transform matrices and not the adaption of a quat to a matrix) gives far better results for the camera, specially because the transforms can have simple intuitive commands to move the camera around...

Share this post


Link to post
Share on other sites
I''d have to disagree with mister Anonymous Poster here. Quaternions are generally more mathematically intuitive than matrices when it comes to rotations, and they can be manipulated in all the same ways, so...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Actually... NO! Quats are not more intuitive mathamatical beings, for me. Quats and matrices give you exactly the same result, although quats allow you to do some interesting things, matrices are actually easier to understand. The only thing that you''ve got to remember is that a rotation/translation/scalling matrix is nothing more than a transformation matrix which transforms vectores fom one vector space to another vector space. Said like that it might sound daunting, but the fact is that with an example image anyone would understand what I''m saying and if you have all your data stored in some kind of scene graph structure using matrices could save you a lot of trouble with various implementations (although you have the added cost of matrix multiplications) using an extremely intuitive implementation.

Other then that using matrices for something as simple as a rotation is still a simple case, just make a matrix with the adequate rotations (with matrix multiplication) and apply...

Share this post


Link to post
Share on other sites
I''m writing a tutorial on a full 6 degree of freedom camera system using matrices right now. should be finished and in a couple days, mainly because as said before, most are dreadful.

What it comes down to is you need 3 axes and a position. You need to be able to rotate about these 3 axes.
If you''re using d3d you can use either D3DXMatrixRotationAxis or D3DXQuaternionRotationAxis and both will work, only if you''re going to alter the view matirx (as most cameras do) you''ll have to convert your quaternion back to a matrix, which is an extra step you don''t have to do with matrices.
that said, quaternios offer the interpolation advantages that matrices don''t, but if you don''t need interpolation in your camera then go with matrices.

D3DX Allows you to use either matrices or quaternions without understanding the theory anyway so the debate about which is easier to understand is mute.

I''ll post back when the tute is funished.

Toby

Gobsmacked - by Toby Murray

Share this post


Link to post
Share on other sites