Find a Rotation Matrix That Rotates a Given Vector $V$ to a Given Vector $U$

1.1k Views Asked by At

Given normalized vectors $U=(u_1,u_2,u_3)$ and $V=(v_1,v_2,v_3)$, find a rotation matrix $R$ such that $RV=U$.

I've read these topics: Find a rotation matrix that sends $v$ to $u$

Finding a specific Rotation matrix given a known vector

And many other links but didnt find them very useful.

I'd be glad for help.

2

There are 2 best solutions below

4
On

The easiest way, in my opinion, is to use Householder reflection. It is a unitary transformation with the following matrix $$H = I_n - 2\nu\nu^T$$ where $H \in R^n$, $\|\nu\| = 1$ and $n$ is the dimension of the vectors that you deal with. Now, the question is to find the matrix $H$ such that $y = Hx$, with $x,y \in R^n$. Sufficient condition is $\|y\| = \|x\|$ (H is unitary, it does not change the norm) which is provided. So: $$Hx = x - 2\nu\nu^Tx = y$$ $$\nu = \frac{x-y}{2\nu^Tx}$$ since $\nu$ is unit vector: $$\nu = \frac{x-y}{\|x-y\|}$$ If you apply $H$ to any vector in $R^n$, it does not rotate them in the exact same angles as it rotates $x$. Instead, It reflects them with respect to the same plane that $x$ is reflected.

0
On

Thank you all for the answers.
The Rodrigues' formula did work, so let me try to give the full solution.


The solution:

Given $2$ vectors $\vec V=(v_1,v_2,v_3)$ and $\vec U=(u_1,u_2,u_3)$, we need to to find a rotation matrix $R$ such that $R\cdot$$\vec V=\vec U$

Let $\vec W= (w1, w2, w3)$ be the cross-product $\vec V$$\times$$\vec U$. Normalize it. $\vec W$ is now our rotation axis.

let $K$ be the matrix representation of $\vec W$. $$K = \begin{bmatrix}0&-w3&w2\\w3&0&-w1\\-w2&w1&0\end{bmatrix}$$ The angle $θ$ between the two vectors $\vec U$ and $\vec V$ is:

$$θ = arcsin\Biggl(\frac{ \lVert\vec W\lVert}{\lVert\vec V\lVert\cdot\lVert\vec U\lVert}\Biggl)$$
while $\lVert\vec W\lVert$ is the lengeth of $\vec W$.

Let $I$ be the identity matrix.

The Rodrigues' formula for the rotation matrix R is as follows:

$R = I+sin(θ)\cdot$$K+(1-cos(θ))\cdot$$\mathrm{K}^2$

while $\mathrm{K}^2$ is the multiplication of the matrix K by itself.

Then, you can simply multiply $R$ by any vector to apply the same rotation on it.