Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 What the (explitive deleted) is a Quaternion?
 New Topic  Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

cbx
Swordmaster

Canada
296 Posts

Posted - Apr 02 2003 :  3:02:47 PM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
After browsing through the game dev fourms regarding Diana Gruber's "Do We Really Need Quaternions?" article It reminded me of a paragraph in her article ...

quote:
Believe it or not, the quaternion vs. vector debate goes back more than 100 years. Quaternions were developed by William Rowan Hamilton around 1843 and immediately took their place in mathematical history as a solution in search of a problem. In 1901, just two years before his death, a Yale professor named Josiah Willard Gibbs published a treatise on vector algebra which included a definition of the vector dot product and vector cross product. Vector algebra was put forth as a simple, robust alternative to quaternions. Egos erupted, tempers flared, and the debate raged. Gibbs' vectors were championed posthumously by his colleague, Edwin B. Wilson, along with Oliver Heaviside in England. Quaternions were defended by Peter Guthrie Tait, but it was a losing battle. Vector algebra triumphed over its non-Euclidean predecessor, and the popularity of quaternions faded.


... The fact the the human race has been arguing about vectors verses quaternions for over 100 years is a testament to how much we humans just love to squable.


Created by: X
http://www.createdbyx.com/
Go to Top of Page

SteveUCI
Neophyte

USA
1 Posts

Posted - Apr 09 2003 :  02:57:50 AM  Show Profile  Visit SteveUCI's Homepage  Send SteveUCI an AOL message  Reply with Quote
It was my understanding that the advantage of quaternions was that you can avoid gimble lock which is the "problem" that comes about when you try to rotate around more than 1 axis away from the origin.

I once worked on a little galaxy simulation (who hasn't) and rotating my view from the origin was basically as simple as rotating around the 3 axes in succession.... however once I moved away from the origin, doing that same viewpoint rotation around the 3 axes proved very problematic (hard to describe, but the results were not what was expected).

Now I haven't tried any other approaches since then (it was a long time ago when I did rotations manually in cod -- perhaps if I did what 3D hardware now does and translate the entire world toward the origin before applying viewpoint rotations it would work), but I seem to remember finding out that I had to learn about quaternions to get around the problem I was running into.

Since then, instead of learning about quaternions, I simply resigned to rotating around only the vertical axis as I moved about 3d space.

Am I way off?
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Apr 09 2003 :  11:24:39 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
You can also use the "axis-angle" approach, which avoids gimbal lock. You would use a single axis and angle to perform the transformation. One of the nice things about quaternions is that you can interpolate between orientations smoothly, which is wonderfull for things like skeletal animation. Another power of quaternions is that you can extract the the angle of rotation very easily. To do the same thing with Euler angles is pretty much guess work because ArcSin and ArcCos only have a 180 degree range.

Of course, as you have demonstrated, if you know about gimbal lock, then you can design things to avoid it.
Go to Top of Page

cbx
Swordmaster

Canada
296 Posts

Posted - Apr 09 2003 :  11:05:00 PM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
Just what was gimble-lock again? Was'nt it somthing about rotations that strayed from there expected path slightly?

Another thing. Is it not true that gimble lock is irrelavant in games because the matrix that stores the rotation result gets rebuilt with the updated rotations before every rendering is done?

And one last thing ...
quote:
One of the nice things about quaternions is that you can interpolate between orientations smoothly, ...


... you can do that with D3D also ala Vector3.Lerp (DX9) or D3DXVec3Lerp (DX8) can't you?

Created by: X
http://www.createdbyx.com/

Edited by - cbx on Apr 09 2003 11:11:36 PM
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Apr 10 2003 :  01:26:04 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
Gimble lock is when a rotation cancels out another rotation, effectively removing a degree of freedom. If you do a 90 degree rotation along the X axis, then a 90 degree rotation around the Y axis, then you have gimble lock when trying to rotate around the Z axis because the Z is now the same thing as the X.

Lerp, aka interpolation, can be done with anything. When interpolating between two rotation matrices, the Euler interpolation creates intermediate orientations that are not the shortest path between the beginning and ending orientation. This makes the transition ugly. The quaternion path between two orientations is always the shortest path along a great circle joining those two orientations.
Go to Top of Page

cbx
Swordmaster

Canada
296 Posts

Posted - Apr 10 2003 :  12:07:01 PM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
Could you explain Euler interpolation? Are you refering to linear interpolation when you say this?

I am going to write some test code to try and proove you wrong about lerp, and gimble-lock, because I don't believe that is correct!


Created by: X
http://www.createdbyx.com/
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Apr 10 2003 :  10:40:31 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
Blending between two Euler orientations is simply interpolating between the matrices. v' = (M1 * (1-t) + M2 * t) * v Where M1 and M2 represent the two orienatation matrices, v and v' are vectors, and t is a scalar. This is just basic alpha blending; the two matrices are blended using a scalar alpha value. You should look at the quaternion example in the SDK. It shows the transition between two orientations using quaternion slerp. slerp stands for spherical linear interpolation.

As I've said before, you don't need to use quaternions in a 3D game. If you don't feel comfortable with them, then there really is no need to use them other than for very special purposes.
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.12 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.