|
Boost : |
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2024-05-12 11:56:08
> On 11. May 2024, at 21:55, Andrzej Krzemienski via Boost <boost_at_[hidden]> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk