Let's call the angle $\theta$, and the axis $\underline{\text{n}}$. I'd like to rotate a 3 dimensional vector $\underline{\text{v}}$ by $\theta$ about the $\underline{\text{n}}$ axis. I know that the rotation matrix $\underline{\underline{\text{R}}}$'s elements are $R_{kl}=\cos(\theta)\delta_{kl}+n_kn_l(1-\cos(\theta))+\sum\limits_{m}\epsilon_{kml}n_m\sin(\theta)$, but I'd like to do it a different way: Transform the vector to a different basis, where $\underline{\text{n}}$ is the z axis, and rotate there:
$\underline{\underline{\text{R}}}\underline{\text{v}}=\underline{\underline{\text{A}}}^{-1}\underline{\underline{\text{R}}}'\underline{\underline{\text{A}}}\underline{\text{v}}$
Where $\underline{\underline{\text{R}}}'=\begin{bmatrix}
\cos(\theta) & -\sin(\theta) & 0 \\
\sin(\theta) & \cos(\theta) & 0 \\
0 & 0 & 1
\end{bmatrix}$
But I'm having trouble with finding the $\underline{\underline{\text{A}}}$ matrix. Is there an easy way to find it?

2 Answers
2

The problem you're having probably arises because given $n$, there's no "natural" way to pick $v_2$ and $v_3$.

Because $n$ is a unit vector, you can regard its "tip" as a point on $S^2$. Then $v_2$, as a vector perpendicular to $n$, is a tangent vector to $S^2$ at the tip of $n$. If there were a continuous way to choose $v_2$ as a function of $n$, you'd have a continuous everywhere nonzero vector field on the 2-sphere, which would contradict the "hairy billiard ball" theorem -- that for every vector field on the 2-sphere, the algebraic sum of the indices at the zeroes of the field is two, hence, there must be someplace where the vector field is zero. So that's a proof that there's no continuous way to get $v_2$ from $n$.

Because $c$ is nonzero, the vector $w_2$ is nonzero, so it can be 'normalized' to get $v_2$. You then pick $v_3 = n \times v_2$.

What if the $z$-component of $n$ actually is zero? Then you suppose that the $y$-component is nonzero and do something similar. What if the $y$ and $z$ components are both zero? Then $n = \pm e_1$, and you pick $v_2 = e_2, v_3 = e_3$ and you're done.

Note that this sequence of "what do you do if ...?" things amounts to a piecewise definition of $v_2$ in terms of $n$, and the piecewise-ness is exactly what makes continuity fail.

post-comment addition

Once, starting with $n$, you've produced $v_2$ and $v_3$, I'd be inclined to form a matrix $A$ whose first column is $n$, whose second column is $v_2$, and whose third is $v_3$. (I've altered $n$ above to be a column vector so that this makes more sense.) If you do this, then $A$ will be orthogonal, so that $A^t = A^{-1}$, and
$$
A \pmatrix{1 & 0 & 0 \\ 0 & c & -s \\ 0 & s & c} A^t
$$

$\begingroup$Thank you for covering everything. It's much easier to remember (and also to prove) it than the R matrix I've given above.$\endgroup$
– BotondJan 5 '18 at 23:07

$\begingroup$Actually, the R-matrix you've given above comes from Rodrigues' formula, which is pretty simple to prove. (You can see the proof in Computer Graphics, Principles and Practice, 3rd ed, on which I'm the lead author, among other places.) If you write $$R = c\mathbf I + (1-c) \mathbf {n n^t} + s U$$, where $U = \pmatrix{0 & -c & b \\ c & 0 & -a\\ -b & a & 0}$ is the matrix of the transformation $v \mapsto n \times v$, then it's clear that $Rn = n$, and if $v$ is perp to $n$, then $Rv = cv + (1-c)0 + s n \times v$, which represents rotation by $\theta$ in the plane perpendicular to $n$.$\endgroup$
– John HughesJan 5 '18 at 23:46

$\begingroup$I've seen my teacherderiving it on a black board, with vectors and also quaternios, but it was fast and required too much visualization. But I'm going to check your book, it might be understandable.$\endgroup$
– BotondJan 6 '18 at 0:03