|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Quaternion Powers |
|
![]() Void Member since: 9/12/1999 From: Singapore |
||||
|
|
||||
| I was informed about another typo. Credit goes to Navreet Singh gill. "Rotation Order - The sequence of rotations in the Euler representation is X, then Y, and then Z. In matrix form: RotX * RotY * RotZ <-- Very Important" It should be RotZ * RotY * RotX to more closely follow OpenGL "default" convention books. But I suppose you could view it as v * RxRyRz too and everything's cool. |
||||
|
||||
![]() bloc Member since: 10/29/2002 |
||||
|
|
||||
| A little more info about multiplying quaternions: As stated in the article, multiplying two quaternions in different orders will likely produce different results since i * j = k while j * i = -k. Let's have a set of rotations called quatFirst, quatSecond, quatThird. We want to apply them in that order. Let quatTotal be the concatenation of all of these. Initially it's set to w = 1 axis = (0, 0, 0), the multiplicative identity quatTotal *= quatFirst; // simple If we want to apply the second rotation, we might try this: quatTotal *= quatSecond // *** wrong *** This will produce the wrong rotation. quaternion multiplication requires the order to go from right to left, where the right most is the oldest and the left most the youngest. quatTotal = quatThird * quatSecond * quatFirst; // correct or quatTotal = quatSecond * quatTotal; quatTotal = quatThird * quatTotal; (Depends on your multiplication function of course as some libs switch the order for you so you can write it left to right, yet produces the same result) |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| In "What is a Quaternion?", ----- q = w + xi + yj + zk where w is a real number, and x, y, and z are complex numbers. ----- It should be ----- q = w + xi + yj + zk where w is a real part of q, and x, y, and z are imaginary part of q. ----- |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Still looking to convert from quat to euler? Check this. http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/ dont know if it works still working on it hope i helped Posted by MHGameWork |
||||
|
||||
![]() kortinov Member since: 9/13/2005 From: Lyon, France |
||||
|
|
||||
| Hi, I had seen "scale = sqrt (x2 + y2 + z2) Another variation I have seen is that the scale = sin(acos(w)). They may be equivalent, though I didn't try to find the mathematical relationship behind them." We start with : sin(arcos(w)) sin(arcos(w)) = sqrt( sin²(arcos(w)) ); sqrt( 1 - cos²(arcos(w)) ); sqrt( 1 - w² ); if x²+y²+z²+w² = 1 then 1-w² = x²+y²+z² So sin(arcos(w)) = sqrt( x²+y²+z² ); Enventually, it run only if the quaternion is normalized. |
||||
|
||||
![]() MathsPoetry Member since: 2/2/2009 From: Strasbourg, France |
||||
|
|
||||
| "So if we are using a unit quaternion to represent the camera orientation, we have to convert the quaternion to a matrix first: Rotate (from Quaternion) * Translate" No. A better method to rotate a vector is to use V' = q . V . q*, where : - q is the quaternion - V is the "quaternized" vector, i.e. (0, x, y, z) wher (x, y, z) are the vector coordinates - q* is quaternion's conjugate - we apply twice the quat multiplication - the result V' is the "quaternized" form of the rotated vector It is therefore possible to do all computations with pure quaternion operations, without ever appealing to matrices. This leads to much less computations, and, if i'm not wrong, completly avoids any gimbal lock problems. Sorry in advance if I have misunderstood what you meant. |
||||
|
||||
![]() Brother Bob Moderator - OpenGL Member since: 11/26/2001 From: Ronneby, Sweden |
||||
|
|
||||
Quote: Gimbal lock depends on Euler angles, not matrices or quaternions. It is entirely possible to avoid gimbal lock with matrices by not using Euler angles, and it is entirely possible to get gimbal lock with quaternions if you use Euler angles. |
||||
|
||||
![]() Sneftel Moderator - Consoles, PDAs, and Cell Phones Member since: 7/7/2001 From: Philadelphia, PA, United States |
||||
|
|
||||
| It's also possible to avoid gimbal lock even if you're using Euler angles. Gimbal lock is dependent on what you're trying to make happen, not just what data representation you're using. If you're not doing any IK, you probably have nothing to fear from gimbal lock. |
||||
|
||||
![]() altra4u Member since: 2/10/2008 From: Philadelphia, PA, United States |
||||
|
|
||||
| I have certain questions You said the final quaternion is obtained by Qx * Qy * Qz.Did you also mean the same order of multiplication(if referencing local axis) or Qz * Qx * Qy(if referencing absolute global axis)?In your example you do x then y then z. Also when we do the multiplication for the quat created on key input,we will again need to keep in mind which axis(global or local) we are referring to right? I am trying to follow your example and I am again getting a gimbal lock despite the fact that I am using quats.I am following y first then x then z.So my quat was constructed like Q = Qz*Qx*Qy.Is it the premultiplication that tells it that I want to rotate around the absolute global axis? Its hard to compare to your example directly as I am using a left hand coordinate system with a different order of rotation. P.S:I believe I have goofed up the math somewhere as after a full rotation of 90 degree around the y axis,if I rotate around the x axis I get an axis value for both x and z.It should be only for x.It works fine till I am rotating around only 1 axis so I think the multiplication should be alright.Finding it hard to pin down the error. |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|