Y
Y
YURITIGER2016-01-27 15:08:57
Mathematics
YURITIGER, 2016-01-27 15:08:57

How to convert quaternion to spherical angles of rotation?

Good afternoon!
Please tell me where you can find a mathematically painted transformation of quaternions into spherical rotation angles and vice versa. I found such a conversion program:
9fcd5c5187714513869ab9f164eead19.jpgbut I could not figure it out

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andryukha, 2016-01-27
@YURITIGER

In any book on 3d graphics, for example for game developers. In this example, the following happens. A quaternion is a rotation around a vector, it is normalized, i.e. its length is 1, and it also has a fourth coordinate, unlike a 3d vector, so it's a 4d vector. If we say that the vector around which the rotation occurs V and the angle alpha, then q == { sin(alpha / 2) * Vx, sin(alpha / 2) * Vy, sin(alpha / 2) * Vz), cos(alpha / 2) }. The first line actually highlights the fourth component, although it would be more accurate:
half_cos_alpha = q->w;
The second line gets the sine of the half angle, according to the Pythagorean theorem, and given that V is a unit vector, thus:
half_sin_alpha = sqrt(1.0 - half_cos_alpha * half_cos_alpha)
And so on :) (considering that the text is clearly not complete and sa is not initialized at all). The idea is probably to rotate the point (unit vector) {0, 0, 1} using this quaternion, and then determine the latitude and longitude of this point (as a unit vector).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question