Apply $R_{n}$ to each of the standard basis vectors.

118 Views Asked by At

Recently, I'm reading a book named 3D Game Programming With DirectX 11, and there is a linear transformation I cannot figure it out (3.1.4 Rotation in Chapter 3).

It describe rotating a vector v about an axis n by angle $\theta$.

enter image description here

And the book gives me the following rotation furmula:

$$ \begin{equation}\begin{split} R_{n}(v)&=proj_{n}(v)+R_{n}(v_{\perp})\\ &=(n \cdot v)n+cos\theta v_{\perp}+sin\theta(n\times v)\\ &=(n \cdot v)n+cos(v-(n \cdot v)n)+sin\theta (n \times v)\\ &=cos\theta v+(1-cos\theta )(n \cdot v)n+sin\theta (n \times v) \end{split}\end{equation} $$

Now we let $c = cos\theta$ and $s=sin\theta$, and apply $R_{n}$to each of the standard basis vectors, and then place the resulting vectors into the rows of a matrix.the final result is:

$$ R_{n}= \begin{bmatrix} c+(1-c)x^2 & (1-c)xy+sz & (1-c)xz-sy\\ (1-c)xy-sz & c+(1-c)y^2 & (1-c)yz+sx\\ (1-c)xz+sy & (1-c)yz-sx & c+(1-c)z^2 \end{bmatrix} $$

I cannot figure it out ,what's happening?

1

There are 1 best solutions below

0
On BEST ANSWER

I am assuming you're mainly concerned with the part you put in bold text.

apply $R_n$ to each of the standard basis vectors, and then place the resulting vectors into the rows of a matrix

In terms of the standard basis vectors $e_i$, $e_iR_n$ is the $i$th row that you inserted into $R_n$, and this simply represents the coordinates of the standard basis vector $e_i$ after rotation.

The thing to keep in mind is that after you've determined how to map the basis vectors, the images of all remaining vectors are completely determined already. That's why building a matrix using the standard basis vectors results in a matrix that works for the rest of the vectors.


Conceptually, the rotation looks a lot simpler if you take $n$ and normalize it to $u$, and use it as the first basis element. Then you can cook up an orthonormal basis $u,a,b$ and the matrix to rotate around $n$ looks like this:

$$ R'=\begin{bmatrix}1&0&0\\0&\cos(\theta)&\sin(\theta)\\0&-\sin(\theta)&\cos(\theta)\end{bmatrix} $$

where you are multiplying with row vectors on the left.

The problem is that this isn't the transformation to the standard basis, it's with respect to our odd basis $\{u,a,b\}$. The steps they took above build the similar matrix in terms of the standard basis, making it look more complicated. These two matrices are related by some nonsingular matrix $X$ such that $XR'X^{-1}=R_n$.