8 ms·
Hmm, but I would think that a quaternion represents a rotation in R^4 (for which I lack intuition).
by Bootvis 10y ago
Hmm, but I would think that a quaternion represents a rotation in R^4 (for which I lack intuition).
- uryga 10y ago===== EDIT: this is mostly wrong - see jblow's reply. Sorry for misleading you into thinking I know what I'm talking about :D ===== I think of it like this: a complex number represents a rotation in a plane. You need two "coordinates" to do that. 2d has one plane, but 3d has two planes - think about how an anti-air cannon rotates left-right and up-down. So, if we've got two rotations to represent, you must need two complex numbers - that's four "coordinates", or one quaternion.
- chombier 10y ago> but 3d has two planes Why not 3 planes?
- uryga 10y agoOkay, my wording wasn't the best here. 3d doesn't "have" 2 planes. But, for some reason, you can look in any direction in 3d by turning in two planes. Test it yourself: turning your head left-right is rotation in one plane, turning it up-down is rotation in the other plane. here's my shot at illustrating this: https://goo.gl/photos/Cxt7KPbos5o2QnkD9 https://goo.gl/photos/Cxt7KPbos5o2QnkD9 to be completely honest, I'm not sure if this intuition is correct. But it seems to make sense
- jblow 10y agoIt's correct that you can look in any direction with only two planes, but that's not enough; you need to be able to control your orientation around that final axis. You need 3 planes for that (3 "rotational degrees of freedom"). The idea that a quaternion is somehow two complex numbers is wrong.
- uryga 10y agoThanks. I did some research and found out that, indeed, my vague understanding of quaternions was wrong. I remember skimming the Wikipedia article and seeing this: https://en.m.wikipedia.org/wiki/Quaternion#Quaternions_as_pairs_of_complex_numbers https://en.m.wikipedia.org/wiki/Quaternion#Quaternions_as_pa... I then assumed that my idea with two rotations is how quaternions work. Here's to actually reading about a concept before I start explaining it next time...
- chombier 10y agoI think you can do that using two rotation axis only (cf. proper Euler angles). And quaternions are made of two complex numbers. edit: typo.
- Kristine1975 10y ago>And quaternions are made of two complex numbers. I don't pretend to grok quaternions (I only use them), but I'm fairly sure a quaternion consists of three imaginary numbers plus a real number.
- petters 10y agoI don't think that's correct. You can also rotate around the direction you are looking. Rotations in 2D are one-dimensional. Complex numbers are two-dimensional but we fix one degree of freedom by fixing the length. Rotations in 3D are there-dimensional. Quaternions are four-dimensional but we fix the length again.
- lloeki 10y agoUnfortunately you got it wrong, and your AAA example shows it very well. Just as in 2d with a complex, in 3d you can encode rotations with a 3d vector. The problem is that to reach any point from any other arbitrary point you can't use a single rotation, but a combination of two, sometimes three. Think about how your AAA gun operates or FPS viewpoint controls. Thus you start to use rotations along the three axes of a base which gives you a typical rotation matrix. As soon as you start to compose rotations along axes you introduce a terrible phenomenon known as gimbal locking, where discontinuities appear especially near north and south poles. And so, just as a 2D rotation in a plane can be represented by a vector orthogonal to that plane (i.e in a space outside the plane), the gimbal lock and all artifacts that are cumbersome when constraining ourselves in 3D can be dealt with by going up a dimension... Hence quaternions which encode+ a rotation by putting an arbitrary but well chosen axis and an amplitude in a space grown othrogonally to our 3D space. + Or isomorohically so
- blt 10y agoYour analogy is incomplete because you forget rotating the cannon about its barrel.
- Sharlin 10y agoIf you only want to represent a rotation there's some extra information in a quaternion, just like there is in a complex number - an arbitrary number in C actually represents rotation-and-scale where the magnitude of the number is the scale factor. If you stick to numbers with unit magnitude, given one part you can calculate the other, up to reflection. Similarly, with a unit quaternion you can calculate any one component given the other three, again up to reflection. In general the number of real numbers needed to describe a rotation is the number of rotational degrees of freedom. This number is n(n - 1) / 2 in n dimensions, or C(n, 2), basically the number of orthogonal (2-)planes of rotation in R^n. [0] https://en.wikipedia.org/wiki/Degrees_of_freedom_(mechanics) https://en.wikipedia.org/wiki/Degrees_of_freedom_(mechanics)
- UlyssesSKrunk 10y agoSo in 3d that becomes 3(2)/2 = 3. Quaternions have 4 parts. That's what has always made it hard for me to understand.
- Sharlin 10y agoAnd in 2D it is 1 but complex numbers have two parts. As I tried to explain, there's simply some redundancy in the representations because it's just unit complex numbers/quaternions that we're interested in. We accept that because it makes the math prettier. Heck, matrices, the de facto standard for representing rotations, have much more redundancy - four and nine elements in 2D and 3D respectively.
- Kenji 10y agoWe use quaternions in R^3 to avoid gimbal lock.
- logfromblammo 10y agoThe constraints between the numbers, when the quaternion is defined as a rotation, end up having three degrees of freedom, spread over four numbers. You can't change any one of them without also changing another or violating the constraints of the rotation definition. Similarly, when a quaternion is defined as representing a translation, that is likewise 3 degrees of freedom in 4 numbers. The four numbers would be similar to a real cartesian translation with dX, dY, dZ, and a fourth number = sqrt( dX^2 + dY^2 + dZ^2 ). It's like the 4th number is a checksum for the other 3. You are adding a fourth number to use a more elegant mathematical calculation, which automatically keeps the dependent data relationships intact, like magic.
- chombier 10y ago> Similarly, when a quaternion is defined as representing a translation How do you encode translations with quaternions? Don't you need dual quaternions for that?
- logfromblammo 10y agoNo. You need dual quaternions to encode rotation and translation at the same time.
- chombier 10y agoOk this I know, but how to do translations only? (apart from the obvious vector space structure in R4)
- logfromblammo 10y agoThere are multiple ways that will work. The simplest I can think of is to fix the real part at zero and use i, j, and k to represent deltas along the x, y, and z axes. Then point + translation = point. There may also be a representation that also encodes distance from the origin, but I am probably confusing this in my memory with something else.