Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotation vectors vs quaternions

A rotation vector represent rotations by directly storing the axis of rotation and the angle magnitude.

Quaternions seem to be used much more to represent rotations. Why are quaternions preferred over rotation vectors in computer graphics?

like image 250
user782220 Avatar asked Jun 07 '12 06:06

user782220


People also ask

Why are quaternions better than rotation matrices?

Quaternions are very efficient for analyzing situations where rotations in R3 are involved. A quaternion is a 4-tuple, which is a more concise representation than a rotation matrix. Its geo- metric meaning is also more obvious as the rotation axis and angle can be trivially recovered.

Are quaternions faster than rotation matrices?

It's quicker and more efficient to renormalize a quaternion than it is to renormalize a rotation matrix.

How do you rotate a vector with quaternions?

you can solve for the rotation angle using the axis-angle form of quaternions: θ = 2 cos − 1 ( a ) . q rv = θ sin ( θ 2 ) [ b , c , d ] .

Are quaternions just vectors?

As mentioned earlier, quaternions are composed of a scalar and a vector. Since both scalars and vectors are present in a quaternion, the mathematical rules used to work with them are a combination of scalar and vector mathematics. The result of multiplying two quaternions is a new quaternion.


1 Answers

Quaternions are much easier to compute with, for the computer of course (as a human you shouldn't bother with 3D rotations anyway):

  • What do you do when you want to concatenate two rotations in vector representation? You have to convert them to quaternion or matrix form (using costly trigonometrics) to do that (and maybe back again), whereas quaternions can be concatenated efficiently by using the classical quaternion multiplication.

  • What do you do when you want to rotate a point/vector using a rotation in vector-format, or send it to GL/D3D as matrix? You convert it into a matrix (again using costly trigonometrics). A quaternion on the other hand is quite efficiently converted into a matrix, since it already encodes the needed sines and cosines.

So matrices and quaternions are much more appropriate rotational representations. From those two quaternions are more compact and they are also quite easy to convert into an axis-angle representation (and back again), though using trigonometrics. So if you need axis-angle information at the peripherals (it's only us humans who sometimes need an actual rotation axis and angle, the computer doesn't really care) you can still use it, but for internal representation and computation quaternions or matrices are a much better choice.

If quaternions seem a bit heavy at first with their "3-dimensional complex number" explanation, don't bother with their exact mathematical underpinnings. Just start to understand how they work and how to use them. Pragmatically they are just a kind of axis-angle representation, but with implicitly encoded sines and cosines, which are needed for efficient transformation and computation.

like image 123
Christian Rau Avatar answered Sep 28 '22 01:09

Christian Rau