by imadr on 6/1/21, 12:03 PM with 154 comments
by gspr on 6/1/21, 12:58 PM
Rotations of 3-dimensional real space form the topological group SO(3). Naive parameterizations of that group do not form a cover [1], but the group of norm-1 quaterinons, Spin(3), does.
The failure of naive parameterizations, like the Euler angles, to be a cover manifests itself as gimbal lock.
by OmarShehata on 6/1/21, 2:51 PM
This is a common misconception.
Euler angles can be used to rotate an object exactly the same way as quaternions do with no gimbal lock. Similarly, you can apply quaternions in such a way that gimbal lock will happen (if you wanted to represent a physical system of gimbals with quaternions, where that is a physical property).
I wrote a short article demonstrating and clarifying this, hope it helps: https://omar-shehata.medium.com/how-to-fix-gimbal-lock-in-n-...
by aardvark179 on 6/1/21, 1:07 PM
I don’t entirely agree with the article’s viewpoint that people do not perfectly understand quaternions and therefore they should not be used, as I get the feeling there are many parts of 3D graphics that are not perfectly understood by developers, and that’s okay.
by greggman3 on 6/1/21, 6:04 PM
This is an issue with the GLTF format. They chose quaternions to represent rotations in animation and as such can't easily represent what the artist's intent was.
You might claim you can sample the Euler animation and split it into multiple quaternion slerps but that brings up another issue which is you need support for discontinuous animations in order to handle other situations (another thing the GLTF format apparently didn't consider).
by vladTheInhaler on 6/1/21, 5:21 PM
by imadr on 6/1/21, 12:04 PM
by Jyaif on 6/1/21, 2:51 PM
If you are not careful, this is what you may end up with: https://www.reddit.com/r/FIFA/comments/9gms3n/most_realistic...
by FabHK on 6/1/21, 1:17 PM
0) Very nice practical introduction to quaternions and their application to rotation.
1) Neat didactic "textbook" implementation, but note that it is not production quality (eg potential overflow in the norm function unnecessarily). That was not the aim, either, but just something to bear in mind.
2) As a supplement, a useful practical reference for rotations in 3D (with good clarifications and basically all formulae you'll ever need, but no implementation) is
Representing Attitude: Euler Angles, Unit Quaternions, and Rotation Vectors by James Diebel
https://www.astro.rug.nl/software/kapteyn-beta/_downloads/at...
by rthomas6 on 6/1/21, 1:54 PM
by unholiness on 6/1/21, 9:00 PM
The interactive videos alone are quite the technical feat, but after going through it, it's honestly hard to imagine fully understanding this topic with less technology (or with a less incredible teacher!)
by rdevsrex on 6/1/21, 6:17 PM
by Scene_Cast2 on 6/1/21, 3:44 PM
by darkstarsys on 6/1/21, 1:57 PM
by sojuz151 on 6/1/21, 4:43 PM
by ww520 on 6/1/21, 5:12 PM
by mwkaufma on 6/2/21, 12:44 AM
by gabereiser on 6/2/21, 3:21 AM
by Animats on 6/1/21, 8:48 PM
by captainmuon on 6/1/21, 6:41 PM
Is it really a vector in the physical sense? People often say vector when they mean N-tuple -- for example we learned in high school that vectors are just N numbers taken together.
For physicists, a vector must satisfy certain transformation laws - it must transform in the correct way if a rotation is applied, and the scalar product must be invariant of the coordinate system, IIRC. I don't have enough intuition of quaternions to say how they behave under transformations, though. I would be surprized if you could have "proper" vectors with four components in three-dimensional space.
by frankus on 6/1/21, 1:10 PM
by marcodiego on 6/1/21, 2:40 PM
w + xi + yj + zk
Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j.
Being u = (x, y, z) = xi + yj + zk a unitary vector parallel to a rotation axis, it is possible rotate any vector q with a theta arc around u by doing:
pqp'
where p = cos(theta/2) + sin(theta/2)u and p' = cos(theta/2) - sin(theta/2)u .
by dnautics on 6/1/21, 2:58 PM
by neonological on 6/1/21, 5:47 PM
I am telling you Quaternions have HUGE issues. These issues become much more apparent when you deal with physical objects.
Here's the thing Quaternions don't exist in reality. It represents an orientation of rotation but it completely masks the path took to achieve that orientation.
For every gimbal in reality there is an actual YawPitchRoll (YPR) that was executed to achieve that orientation. AS soon as you convert that real YPR into a Quaternion you lose the YPR that was needed to achieve that orienation.
So let's say I need to have one gimbal imitate the position of another gimbal. I take the YPR given to me by gimbal "A" convert the YPR to a Quat, send that Quat over the wire to Gimbal "B" and convert that Quat back to YPR to feed to the gimbal so it can rotate itself to imitate the orientation of gimbal A.
The quat is a higher entropy form of information. Now when converting back to YPR there are MULTIPLE YPRs that yield the same orientation. You can derive a YPR that is out of bounds of the physical gimbal.
Literally you can get a YPR that tells your gimbal to Yaw 190 and pitch all the way back past 90 to 170 degrees and roll 180 degrees until it's right side up. This YPR is identical to a yaw of 10, a pitch of 20 and 0 roll. Quaternions hide the original YPR, you lose information so when you receive a Quaternion it's hard to translate it into a physical realization of the orientation.
The company I work for doesn't realize this. They used Quaternions from day one and we have all kinds of headaches like this when we try to extract the YPR and use these orientations in the real world. Actually I should say only I have these headaches. A lot of people haven't figured out this problem yet.
The only time you should use Quats are if you need to transform an orientation or you're dealing with virtual objects that have no rotational limits. Everybody thinks quats are magic and better. They are not. They have huge downsides. Huge.