Finding Rotation Axis and Angle to Align Two "Oriented Vectors"

Solution 1:

OK. Let's say that $(v_1, v_2)$ is the first vector-pair (your "oriented vector"). I'm going to change that to $(v_1, v_2, v_1 \times v_2)$, which is a triple of unit-length, orthogonal unit vectors, and in fact, the basis $(v_1, v_2, v_1 \times v_2)$ is positively oriented (i.e., can be rotated to align with the standard unit vectors $e_1, e_2,$ and $e_3$, in the $x$-, $y$-, and $z$-directions, respectively, in that order). Let $V$ be the matrix whose columns are $v_1$, $v_2$, and $v_1 \times v_2$. Then $$ T_V : \mathbb R^3 \to \mathbb R^3 : v \mapsto Vv $$ is a linear transformation taking $e_1$ to $v_1$, $e_2$ to $v_2$, and $e_3$ oto $v_1 \times v_2$. Clear so far?

Build a similar matrix $W$ for your other set of vectors (extneded by the cross-product).

Now consider the transformation $$ S : : \mathbb R^3 \to \mathbb R^3 :v \mapsto W V^t v=W V^{-1} v . $$ It takes the vector $v_1$ to $e_1$ (when you multiply by $V^{-1}$) and then to $w_1$ (when you multiply by $W$); similarly, it takes $v_2$ to $w_2$. And it also happens to take $v_1 \times v_2$ to $w_1 \times w_2$.

And it's easy to build, because rather than computing $V^{-1}$, you can compute $V^t$, because the unit-ness and orthogonality of the $v$-vectors means that $V^t = V^{-1}$.