Friday, July 29, 2011

Quaternions

If you've ever asked for help on the GMC for 3d rotations, you've probably heard that word. But in my experience, noone has ever really explained them to me, so I never took what they have said at face value. Which is too bad for me, because after doing a little research on my own time, I've found that they are Awesome. I'm not going to write a tutorial in my dev blog, but I'll gladly explain elsewhere (comments section, maybe?) if needed.

I will however provide these three awesome links that helped me out a lot.
http://www.flipcode.com/documents/matrfaq.html
http://www.cprogramming.com/tutorial/3d/quaternions.html
http://www.gpwiki.org/index.php/OpenGL:Tutorials:Using_Quaternions_to_represent_rotation

Anyway, what have I done with quaternions? I have used them to create rotations that can manipulated on the screen with your mouse. The functions are almost completed, but sometimes the original mouse position is forgotten and returning the mouse to it doesn't result with the starting rotation.

With Quaternions I should also be able to merge the turn rotation into the main rotation at compile time, so that's another optimization I should note.

After this, I'll try to incorporate clicking separate parts on the screen to select them, and maybe then I'll be able to redo the GUI (I'm looking forward to it).

No comments: