quaternions
BlitzMax Forums/OpenGL Module/quaternions
| ||
what are these exactly and what are they used for? |
| ||
Check out Chris C's tutorial: http://www.blitzbasic.com/Community/posts.php?topic=55697 |
| ||
So it's for rotation..i'm assuming it's faster than using OpenGL rotate X,Y,Z. It's for making rotation it seems and i don't understand what this math does that a system that makes X,Y,Z rotation to another set of X,Y,Z using addition or multiplication can't. |
| ||
It's just another way of spceifying rotations. Euler angles (pitch, yaw, roll), are fine for most purposes but when you want you want to interpolate between angles (such as for animation), it's usually better to use quaternions as Euler angles can suffer from 'gimbal lock'. Blitz3D uses quaternions internally but hides it from the user. |
| ||
Interestingly you can still demonstrate gimbal lock with Blitz3d as it reduces things back to eular angles... For most applications running round on a surface you'll never experience problems with the dreaded gimbal lock, so its really kind of a mute point The main reason for using quats is for smooth translations of facing if you are making a flight sim or elite type space shooter, then you need to ensure all your rotations are done in quats to ensure you avoid gimal lock |
| ||
gimbal lock? so you basically you apply pitch, yaws, roll into this matrix system..do some calcs and it returns new p,y,r? |
| ||
huh? |
| ||
I'm asking what is gimbal lock? Is that when you hit the 90 degree angles on the pitch and it acts a fool? So quarternions defines angles in matrix formatted matter that elimates the arc trig problems with returning angles from slopes and such? What exactly does the W define in quarternions and does matrix math generially run faster when it's in the language or when OpenGL does calcs? |
| ||
Gimbal lock occurs when 2 rotational axes become aligned W is the quats scalar, bare in mind that a quat is 4d... all calculations should be done with quats and at the last stage converted to a matrix as this is what is needed by opengl... |
| ||
when does that happen? and what's the 4th dimension. |
| ||
quite literally the 4th is imaginary! you usually convert to a matrix in order to set up opengl to draw an object in a quats orientation, so immediatly before drawing a 3d shape |
| ||
alright, well. I've been studying on my own and i think i found the site you got your source from Chris. But i'm still a bit confused. All I want to do is just put in 3 Eular Angles, get the get the proper X,Y,Z,W values, do the instant rotation multiplation and be done. I don't care about converting from a rotation matrix and such( which seems to be more easy to find and understand that what i'm asking for right now). Can someone help with that. |
| ||
I certainly used more than one resource to create that tutorial and the code!! The code also contains historical code from my own software library, if you look at the code you will see a number of functions you can directly call to achieve exactly what you're after |
| ||
Ok, this is what confuses me. When you're gettin a quat from a Angle and then Pitch, Yaw, Roll. I don't understand what Angle parameter? Do i just put 0 or 1 because Pitch, Yaw, and Roll have already been discribe. Also, with the Pitch, Yaw, Roll..are those in angles anyhow? Seems like they are vectors. I know how to convert them to vectors using spherical units. |
| ||
OK, got it. |