# Is adding quaternions a useful operation?

I'm working with quaternions and 4x4/3x3 matrices and I have a doubt regarding the use of them.

I think that adding and multiplying quaternions is the same as converting the quaternion to a matrix, do the operation, and then convert back to quaternion.

My question is: In what situation could adding two quaternions be a thing? I mean, when you are working with matrices and you want to "add" two rotations, you have to multiply. Am I missing something?

• Minor comments: 1) it is not at all common to add quaternions when coding scientific or gaming applications since they're mainly use to represent and compose rotations AND 2) it is not completely ok to to map a rotation matrix to a quaternion and revert back due to the fact quaternions double cover the rotation group (i.e. q and -q represent the same physical rotation). – teodron May 5 '16 at 8:50

I can think of two reasons:

• if your quats represent infinitesimal rotations, adding them together actually yields the composite rotation, provided the result is infinitesimal too (i.e. an element of that algebraic group). Quaternion addition, as opposed to multiplication, is commutative and, well, numerically fast. One situation where this might be "a thing" is if you work with high frequency gyroscopes where the rotation offsets actually amount to infinitesimal rotors.

• when you want to simply approximate an intermediate rotation via normalized lerp (short NLERP). This way, instead of slerping q1 and q2 with a factor lambda you compute the averaged sum (1-lambda)*q1 + lambda*q2 -> q and then reproject q onto the unit hypersphere by dividing it by ||q||.

As a side note of "adding quaternions": quaternions are actually points on a 3-dimensional manifold (unit Hamiltonian hypersphere or whatever it is called). When points on a space that is not Euclidean (i.e. flat) are added, the result is no longer a point in the space of their origin.. unless the points are really close together and adding them approximately amounts to adding vectors in the tangent space of their vicinity. If you want a more detailed digression into the applications and implications of this observation, I refer you and any interested reader to this (more recent) paper on how to compute weighted averages on manifolds with the quaternion case thoroughly examined.

• So, it's just to simplify the operations, right? Thank you for answer me. – STK Oscar May 5 '16 at 9:16
• @STKOscar the operation simplification is more of a consequence in the case of infinitesimal rotations, whereas the nlerp is mostly used because of it being a faster approximation to slerp (no need to evaluate trigonoemtric functions, only a square root - needless to say, if you do many such computations per frame, it saves on some CPU cycles). So yes, with nlerp you get a faster, but more inaccurate approximation to a blended rotation. The difference between slerp and lerp is the velocity at which the shortest path between the rotations is traversed - i.e. non-natural animations. – teodron May 5 '16 at 9:27
• "reprojecting onto a hypersphere" is more commonly know as "renormalizing"? – immibis May 5 '16 at 11:03
• @immibis yes :). Although, when computing weighted averages of quaternions in the tangent plane, reprojection is done via the exp map (in which case the term is no longer equivalent to normalization). – teodron May 5 '16 at 12:14
• The approximate intermediate rotation point can be extended to an average of an arbitrary number of (similar) quaternions, by adding them all together then normalizing the sum. This gives a result that's independent of the order of quaternions in the list (to the extent that floating point addition is associative, which is to say not exactly...) More info in this video, around 40 minutes in. – DMGregory Jan 26 '18 at 15:47