4
$\begingroup$

First I would like to say that I have seen posts such as that found here: Calculate Rotation Matrix to align Vector A to Vector B in 3d? As well as formulas such as: https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula

What I would like is some method to rotate a given vector, A, around each axis in 3 dimensional space (X, Y, Z) so that it aligns with a second vector B. I am NOT looking for a rotation matrix because, as I understand, this does not actually give you the angles of rotation around the three axis'. If there is a way to extrapolate the angles of rotation from a rotation matrix that would work perfectly.

One approach I have tried is to take the two 3D vectors and project them onto a 2D plane, in essence ignoring one of the axis. Once in 2D an attempt was made to find an angle of rotation that would align the now 2D vectors. Using this found angle, a 3D rotation was performed on the original 3D vector around the axis that was extrapolated out during the 2D projection. Repeating this three times, once for each axis. This seemed to work for simple single dimensional vectors but for multidimensional vectors incorrect angles were calculated. By single dimensional vectors working, I am referring to finding the angles of rotation needed to rotate for example {1,0,0} to align with {0,1,0}, and multidimensional vectors that are not working for example would be {1,2,3} to {3,1,2}

$\endgroup$

1 Answer 1

1
$\begingroup$

We refer to the figure below.

Let $V_1$ and $V_2 $ be the normalized vectors $A$ and $B$ (unit associated vectors). It suffices to know how to transform $V_1$ into $V_2$, with resizing at the begining and at the end. So we are going to work on the unit sphere.

A solution to your problem is by the following succession of rotations $R_x$ followed by $R_z$ followed by $R_y$:

  • $R_x$ brings $V_1$ onto a vector $R_x(V_1)$ of the equatorial (xOy) plane.

  • $(R_y)^{-1}$ (take care of the $-1$) brings $V_2$ onto another vector $(R_y)^{-1}(V_2)$ of the equatorial (xOy) plane.

  • $R_z$ brings $R_x(V_1)$ onto $(R_y)^{-1}(V_2)$.

The consequence is that $R_z(R_x(V_1))=(R_y)^{-1}V_2$, meaning that

$$R_y(R_z(R_x(V_1)))=V_2$$

as desired.

I do not enter into computational details: the angles of rotations $R_x,R_y,R_z$ are easily obtained. But we can have a discussion about it.

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .