P
P
prineside2013-11-12 23:57:20
Mathematics
prineside, 2013-11-12 23:57:20

Function for calculating the angle of rotation in a three-dimensional plane?

Since in the ranks of programmers there are often people who know mathematics well, I would venture to ask on Habré.
I ask you not to kick too much, in geometric terminology I am a seventh grader.
There is a three-dimensional space, coordinate axes X, Y, Z (according to Descartes, if I'm not mistaken). There is a cube that stands on its bottom face.
c_1.png
I rotate it by a random angle along two axes (in my case, these are X and Y, the rotation angles are all different, within 0-90 degrees).
c_2.png
The question arose - by what formula to calculate new rotation angles in order to simply turn the cube over to another face? (need to rotate to different faces)
c_3.png
In my head, such an algorithm is “rotate, reset the coordinate axes to their original position, without touching the cube, rotate again”, but in practice I cannot display it. Tried to tritely sum up the rotation along each axis, multiply by the relationship between them, but the "poke" method did not help.
Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Z
Zoberg, 2013-11-13
@prineside

Quote from Wikipedia. Rotation matrix .
Let the axis of rotation be given by a unit vector image, and the angle of rotation image. Then the rotation matrix in Cartesian coordinates looks like:
image
Multiplying the coordinates of some vector by the rotation matrix, you get the coordinates of the rotated vector. All sides of a cube are vectors.

E
engulfer, 2013-11-13
@engulfer

Read: habrahabr.ru/post/131931/
There is a lot of everything on this topic from the very beginning to the matrices.
More about quaternions here or here

V
VoidVolker, 2013-11-13
@VoidVolker

Here is a detailed manual on object rotation, matrices, Euler angles and quaternions.

V
Vitter, 2013-11-13
@Vitter

en.wikipedia.org/wiki/Quaternions_and_rotation_of_space
I think this is it ))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question