[boost.QVM] can you explain quaternions in the docs?
Hi Everyone, I landed on this library docs when trying to learn what quarterions are for. Although the library has a vast documentation it doesn't explain what quaternions are and why they are used. When I was taught algebra for the purpose of computer graphics, vectors and matrices were on the table, but no quaternions. The examples show that I need to create a quaternion only to turn it into a rotation matrix. I am pretty sure there has to be more to it. Could I request an introduction section in the docs that would explain what quaternions are and why one would want to use them? The corresponding GitHub issue: https://github.com/boostorg/qvm/issues/51 Regards, &rzej;
On Sat, May 11, 2024 at 12:56 PM Andrzej Krzemienski via Boost < boost@lists.boost.org> wrote:
Hi Everyone, I landed on this library docs when trying to learn what quarterions are for. Although the library has a vast documentation it doesn't explain what quaternions are and why they are used. When I was taught algebra for the purpose of computer graphics, vectors and matrices were on the table, but no quaternions. The examples show that I need to create a quaternion only to turn it into a rotation matrix. I am pretty sure there has to be more to it.
There's more to it, yes -- but if you know what to do with matrices and vectors, you can think of unit quaternions as a replacement for rotation matrices that provides superior efficiency and interpolation support. If you need examples, anything that has to do with robotics or skeletal animation in video games uses quaternions. I suppose I can include a sentence like this in the docs, but if you need a tutorial, that's beyond the scope of the docs, I think.
On Sat, 11 May 2024 at 23:45, Emil Dotchevski via Boost
On Sat, May 11, 2024 at 12:56 PM Andrzej Krzemienski via Boost < boost@lists.boost.org> wrote:
Hi Everyone, I landed on this library docs when trying to learn what quarterions are for. Although the library has a vast documentation it doesn't explain what quaternions are and why they are used. When I was taught algebra for the purpose of computer graphics, vectors and matrices were on the table, but no quaternions. The examples show that I need to create a quaternion only to turn it into a rotation matrix. I am pretty sure there has to be more to it.
There's more to it, yes -- but if you know what to do with matrices and vectors, you can think of unit quaternions as a replacement for rotation matrices that provides superior efficiency and interpolation support. If you need examples, anything that has to do with robotics or skeletal animation in video games uses quaternions.
I suppose I can include a sentence like this in the docs, but if you need a tutorial, that's beyond the scope of the docs, I think.
It's perhaps worth considering to add a mention of quaternions avoiding gimbal locks. That's one of the major reasons a fair amount of users reach for them.
On 11. May 2024, at 21:55, Andrzej Krzemienski via Boost
wrote: Could I request an introduction section in the docs that would explain what quaternions are and why one would want to use them?
The corresponding GitHub issue: https://github.com/boostorg/qvm/issues/51
Great, I was wondering about the same thing a few years back and now I can share what I learned. Quaternions are a space efficient way to parametrise a rotation in 3D space. They consist of four numbers, which is the minimal amount. Three represent the axis in space around which to rotate and the last number parametrises the rotation angle. Compare this to a 3x3 matrix, which requires 9 numbers, more than twice the amount. Apply multiple rotations in succession is computationally efficient. Let's say you have two or more rotations around different axes and you want to combine them into a single rotation. You can simply multiply quaternions to get the combined rotation as a quaternion. This requires fewer arithmetic operations than doing a matrix product over 3x3 matrices. Last but not least, products of quaterions are always pure rotations as they should be. When you do products of 3x3 matrices instead, the result may not be a pure rotation anymore because of that, it could have a shearing or a scaling component. Really bad.
On 12. May 2024, at 13:56, Hans Dembinski
wrote: Last but not least, products of quaterions are always pure rotations as they should be. When you do products of 3x3 matrices instead, the result may not be a pure rotation anymore because of that,
Sorry, I edited my text too much. By "that" I meant finite floating point precision.
On May 11, 2024, at 22:55, Andrzej Krzemienski via Boost
wrote: Could I request an introduction section in the docs that would explain what quaternions are and why one would want to use them?
A good reference is https://danceswithcode.net/engineeringnotes/quaternions/quaternions.html There is a compendium of formulae for converting to and from 1) Euler angles 2) rotation matrices 3) axis/angle representation The major advantage of quaternions is 1) over Euler angles is avoiding "gymbal lock", 2) over matrices the advantage is less or no redundant data, 3) composing two rotations is difficult with axis/angle but easy with quaternions. Hope that helps alittle
https://www.youtube.com/watch?v=d4EgbgTm0Bg Visualizing quaternions (4d numbers) with stereographic projection youtube.com
On 12 May 2024, at 17:58, Kostas Savvidis via Boost
wrote: On May 11, 2024, at 22:55, Andrzej Krzemienski via Boost
wrote: Could I request an introduction section in the docs that would explain what quaternions are and why one would want to use them?
A good reference is https://danceswithcode.net/engineeringnotes/quaternions/quaternions.html There is a compendium of formulae for converting to and from 1) Euler angles 2) rotation matrices 3) axis/angle representation
The major advantage of quaternions is 1) over Euler angles is avoiding "gymbal lock", 2) over matrices the advantage is less or no redundant data, 3) composing two rotations is difficult with axis/angle but easy with quaternions.
Hope that helps alittle
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (5)
-
Andrzej Krzemienski
-
Bjørn Roald
-
Emil Dotchevski
-
Hans Dembinski
-
Kostas Savvidis
-
Ville Voutilainen