Getting rotation matrix from a vector

132 Views Asked by At

I have a vector pointing in some direction and I'm trying to find a matrix $M$ that rotates the vector $v_1=(1,0,0)$ to $v_2=(x,y,z)$, i.e., $M v_1 = v_2$.
What is $M$ if $v_1$ and $v_2$ are known?

I was thinking of doing:

$M v_1 v_1^{-1} = v_2 v_1^{-1}$ then $M = v_2 v_1^{-1}$

Will this work? if so what is the math for this kind of vector multiplication?

1

There are 1 best solutions below

0
On BEST ANSWER

You should proceed two coordinates per step and produce a rotation matrix.

We begin with $ v_1 = [a,b,c]$ then the first rotation goes by the rotation-matrix $$ t_1 = \begin{bmatrix} 1 & 0&0 \\ 0& \cos(\varphi_1) &\sin(\varphi_1) \\ 0& -sin(\varphi_1) &\cos(\varphi_1) \end{bmatrix} $$ where $\varphi = \tan^{-1} \frac bc $ . Then $$ v_{1,1} = v_1 \cdot t_1 = [a,b_1,0] $$ From that you determine $t_2$ in the similar way. After that you have $$ v_{1,2} = v_1 \cdot t_1 \cdot t_2 = [a_2,0,0] $$ Then we do the same with the vector $v_2 = [A,B,C] $ (where we assume that it is really a rotation of $v_1$) such that $$ v_{2,2} = v_2 \cdot r_1 \cdot r_2 = [A_2,0,0]= [a_2,0,0] $$ If $v_1$ and $v_2$ are rotations, then the first coordinates must now be identical $A_2 = a_2$. Then the matrix $$T = t_1 \cdot t_2 \cdot r_2 ^{\tau} \cdot r_1^{\tau} $$ rotates $$v_2 = v_1 \cdot T $$