why quaternions ??

Started by
7 comments, last by rtime 23 years, 7 months ago
hello everybody... i''ve just read a lot of articles covering quaternions, and that they are better than euler angles, but why ? i understand the math behind quaternions, i understand the gimbal lock (but can''t really imagine how a "gimbal locked" rotation would look like when using quaternions) ok, there is an interpolation-problem, i see this and i understand it... so my questions are: where should quaternions be used ? only for keyframing / camera interpolation or generally ? so long torsten
Advertisement
the thing about quaternions is that it AVOIDS gimbal lock. with euler angles, the axes can get confused (locked) when overlapped, and thus expected behavior does not happen. also, quaternions provide a way to perform rotations with only 4 floats as opposed to a rotation matrix''s 9 floats. which is good for network data. not only that, quaternions avoids the disadvantage that euler angles get inaccurate over time due to small incremental inaccuracies. use quaternions whereever you need to use better rotations. or smoother rotations.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
There was a thread that looked like this one a while ago. Maybe it can help a bit: Quaternions - Why use them?


baskuenen: tnx a lot. i supposed that is topic was old, but the search-engine didn''t work here.. don''t know why.. tnx again

a2k: i know that quaternions avoid the gimbal lock, i just couldn''t imagine how a rotation (that would produce gimbal lock with eulers) would look, when using quat.

hmmm.. the thing with the 4 floats... ok, u can use 4 floats to rotate it in quat. space, but when it comes down to the matrix i have also 9 floats to calculate, and i think this calculation is a lot more expensive than the euler stuff

so long
torsten
baskuenen: hmm read your thread... and the conclusion is, that i... don''T really know if i should use em...

do you use them ?

regards
Torsten
I haven''t used them yet. But it looks interresting, and it''s "high-tech".
I don''t think I''ll be using quaternions for a while, unless I get real bored by matrices.

I think quaternions are only good for smooth vector/camera-position interpolation, or to present a 3D rotation in few variables (size)...now I''m repeating that thread ...

Anyway, have fun if you plan to use them
- Bas

Smooth camera movement: Quaternions

It can be done with matrices, but its just easier with quaternions since there are 4 values to work with (3 defining a simple vector, and 1 theta), while matrices have 9 values, 5 of which are not even used, well i think its 5. 9 - 4 = 5....

Well, you get the point. A third person game like Tomb Raider is a good example of a game that needs smooth interpolation.

And like baskuenen said, they''re "high-tech"!
Just think about it. If you say, "Well my engine uses matrices.", people will say, "So what?".

But if you say, "My engine uses quaternions for smooth interpolation and to avoid gimble lock.", people will think your super-smart!

=======================================
A man with no head is still a man.
A head with no man is plain freaky.
zipster:
cool

so i''ll implement quaternions for some-really-cool-but-dont
-know-what-exactly-thing so i''m supersmart

anyway thanks all...

next weekend i''ll play a little bit with this stuff...

so long
torsten
actually, if you''re kinda looking for a physically graspable explanation to quaternions, then, the closest that it''s related to, but not quite the same as, is the axis-angle method of rotation, in which 3 floats define the vector axis about which an angle is rotated, and the 4th float is, you guessed it, the rotation angle. that''s how you can "sort of" visualize it, but i''ts not quite it. however, the conversion from quaternion to axis/angle is so simple, that their relationship is really close.

i use quaternions because yes, it''s cool, and yes, it avoids gimbal lock, and yes, it''s smooth. it really doesn''t involve much to incorporate in your code. however, it took me a month, due to school and such, but i finally had it working. it''s worth it to learn, because there''s not much to it. there''s plenty of documentation where you can just straight grab the code, and plug it in, and it''ll work. it''s pretty cool, so try it out. =)

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k

This topic is closed to new replies.

Advertisement