News for hackers. Stuff that matters.
Re:How Quaternions encode rotations: derivation and sample code by logfromblammo on Wednesday September 07, 2016 @11:38AM (#12444271)
The 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.

Re:How Quaternions encode rotations: derivation and sample code by chombier on Wednesday September 07, 2016 @12:40PM (#12444813)
> 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?

Re:How Quaternions encode rotations: derivation and sample code by logfromblammo on Wednesday September 07, 2016 @12:45PM (#12444887)
No. You need dual quaternions to encode rotation and translation at the same time.
Re:How Quaternions encode rotations: derivation and sample code by chombier on Wednesday September 07, 2016 @01:26PM (#12445296)
Ok this I know, but how to do translations only? (apart from the obvious vector space structure in R4)
Re:How Quaternions encode rotations: derivation and sample code by logfromblammo on Wednesday September 07, 2016 @02:41PM (#12445903)
There 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.