Advertisement

quaternions :\

Started by January 11, 2003 11:32 PM
4 comments, last by Samith 22 years, 1 month ago
I have read just about all of the articles on quaternions that have been posted in the math article list, yet I still can''t quite understand them... It''s just not there for me yet, I just don''t get it. What I know right now basically is that they avoid the gimbal lock problem. That doesn''t even have anything to do with them though.. I know what a quaternion is, [w, v] where v is a vector and w is a scalar, I can add them and multiply them, but I don''t know what to do with those "skills." Like, how are they used in games? How will they help me and why do I need them? I know this is a pretty broad problem, but it''s really the best I can give you, I don''t really know anything else about them. If anyone wants to give me the lowdown on how to use these quaternions in a game or something that will show me their value to a programmer I would be very grateful, thank you in advance.
Sam Johnston (Samith)
> Like, how are they used in games?

They''re used to represent three dimensional rotations. If you are familiar with matrices then they replace 3x3 rotation matrices. Mostly they are interchangable with these matrices, i.e. everything you can do with matrices you can also do with quaternions. But quaternions are generally faster, sometimes a lot faster, and require less memory.

If you are not familiar with using matrices for 3D transformations you will have problems understanding quaternions, i.e. I would suggest tackling matrices before quaternions.

Once familar with matrices there are a number of articles in the reference section of this site that tell you all you need to know about quaternions.
John BlackburneProgrammer, The Pitbull Syndicate
Advertisement
i know about matrices and stuff, so heres what ive learned now after a bit more research...

you use a quaternion to store an objects rotation, then you convert it into a matrix and use that?



Sam Johnston (Samith)
quote:
Original post by Samith
you use a quaternion to store an objects rotation, then you convert it into a matrix and use that?



Yup. If you want to see an example of this used in graphics, then toddle over to gametutorials.com and look in the opengl section.
One neat thing about quaternions is the fact that you get rid of the problem of keeping the matrices orthonormal, which is often required if you contineously update your rotation. Using quaternions it''s only a matter of vector normalization.
thanks for all the help, i think ive got this just about down now

sark: that tutorial at gametutorials.com is really nice, just what i needed, thanks



Sam Johnston (Samith)

This topic is closed to new replies.

Advertisement