Jump to content
  • Advertisement


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



This topic is 5868 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

I have a question about quaternion. Unfortunately I dont think I understand how to use them. Any help would be appreciated. To rotate a 3d point around an arbitrary axis using a quaternion, do I... create the quaternion from euler angles generate a matrix from the quaternion multiply this matrix by the 3d point I want to rotate Is that it ? Am I missing something ? Also if someone has a *good* article on quaternions (I have already read the ones on gamedev and gamasutra) I would love to read it. Thanks, Nitzan ------------------------- www.geocities.com/nitzanw www.scorchedearth3d.net -------------------------

Share this post

Link to post
Share on other sites
I also looked at the gametutorials tutorial and it wasnt very good. It only rotated around one axis (not arbitrary) and actually seemed pretty useless in the end. It also used the gl function glMultMatrix which is where my confusion lies.



Share this post

Link to post
Share on other sites
this is a great quaternion page:


this is the other classic:

so pour over those. really sit down for a couple hours and understand the math. i tried going forward with quaternions before i understood the math and ended up making some crapo mistakes.

anyway, to answer your questions. you _can_ create a quaternion from euler angles but that is entirely different from creating a quaternion to rotate about an arbitrary axis. while a set of euler angles _can_ be equivalent to a rotation about an arbitrary axis, they are fairly different in practice. one is 3 times the number of multiplications, for instance.

anyway, those 2 pages have explainations about how to do both cases so you should be good to go.

as a word of warning, if you are using euler angles in your objects to represent rotational states, and you are using quaternions to do your actual rotation, you have to be careful. basically the usual method for that process is update euler angles -> create quaternion -> get quaternion matrix -> rotate points. or something to that effect. that method removes the ability of quaternions to protect you against gimble lock. so make sure to put in the appropriate checks for those cases.

quaternions aren't easy. spend a long time understanding the math. eventually it will click and they will be easy.

also find a good openGL reference and look up glMultMatrix() if you want to understand why you might want to use it w/ quaternions. basically it multiplies the current matrix on the selected matrix stack by whatever matrix you pass into it. which brings up another point, openGL has different row/column ordering for matrices than does the rest of the world. if your quaternions appear to be rotating in the opposite direction from what you expect, reverse the row column ordering in your quaternionToMatrix() method.

row column ordering is this: array[x][y]. in one system x is row, in the other x is column. it escapes me at the moment which system is openGL. look it up


[edited by - Palidine on November 21, 2002 2:05:33 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!