5

I'm writing a graphical program and I want to ably rotation on shapes of arbitrary dimension , can some someone explain how to construct matrices for simple ,double... rotation , I don't need the entire mathematics behind it I just want to understand the pattern so that I can construct such matrices efficiently(without much work) in my program .

-is there anyway I can do that without using matrices

-can I project the matrices into a subspace(that exclude the plane of rotation) and then apply rotation .

  • What do you mean when you say "simple, double rotation"? – rschwieb May 09 '13 at 10:16
  • this : http://en.wikipedia.org/wiki/Plane_of_rotation#Double_rotations should I just keep putting a series of cosine(S) along the main diagonal and a series of sin(-sin) on each side for any dimension? – ψευδή ηχώ May 09 '13 at 21:55
  • In terms of a basis $b_1, b_2, b_3,b_4$, that matrix produces a rotation in the $b_1,b_2$ plane, and in the $b_3, b_4$ plane. If you continue to "just put" them in the matrix, then you'll produce rotations in several planes. – rschwieb May 10 '13 at 10:21
  • Without knowing more about what you intend to do, it is very hard to give advice. I don't think a solution can be given without an elementary understanding of linear algebra. – rschwieb May 10 '13 at 10:23
  • I extended the answer a bit. – rschwieb May 10 '13 at 10:42
  • @rschwieb Thank you, the expansion part is pretty much what I wanted to know. – ψευδή ηχώ May 10 '13 at 20:06

1 Answers1

4

"The pattern" is that rotation matrices for $\Bbb R^n$ (I'm not counting mirror images, produced by reflections) are all orthogonal matrices with determinant 1.

It sounds like considering general rotations is not very practical for your purpose. However, if you just want to induce a rotation of $\theta$ radians in a particular plane, that is not hard to describe.

Suppose you have two unit length vectors $u,v\in \Bbb R^n$, and you want to rotate $u$ onto $v$'s position in their plane by rotating that plane $\theta$ radians. Extend $\{u,v\}$ to be a basis $\{u,v,b_3,b_4,\dots, b_n\}$ to be an orthonormal basis of $\Bbb R^n$. This can be done with the usual Gram-Schmidt algorithm.

Then the rotation that you are looking for is given by the matrix

$$ \begin{bmatrix}\cos(\theta)&-\sin(\theta)&\textbf{0}&\\ \sin(\theta)&\cos(\theta)&\textbf{0}\\ \textbf{0}&\textbf{0}&I_{n-2}\end{bmatrix} $$ where the bold zeros mean you are padding those areas with blocks of zeros of appropriate dimension, and the $I_{n-2}$ is the identity matrix with sides $n-2$. This matrix acts on column vectors from $\Bbb R^n$ by multiplication to produce the rotation.

If you would like to express it in the basis you started with, you would have to perform a change of basis on the matrix to bring it back.


Let $B_i=\begin{bmatrix}\cos(\theta_i)&-\sin(\theta_i)\\\sin(\theta_i)&\cos(\theta_i)\end{bmatrix}$ stand for this plane rotation we discussed. In general, for each rotation, there is going to be a basis in which the rotation looks like this:

$$ \begin{bmatrix}B_1&0&0&0&0\\ 0&B_2&0&0&0\\ 0&0&\ddots&0&0 \\ 0&0&0&B_k&0\\ 0&0&0&0&I_j \end{bmatrix} $$

I'm too lazy to make the zeros bold this time, so again they actually stand for more zeros than are there. They are padding out all of the space not used by the $B_i$ and the identity matrix $I_j$.

This is all good if you have a basis and you desire to rotate in the planes of pairs of basis elements. If you want to work in an arbitrary basis, you are going to have to perform a change of basis, and the matrix will lose this shape.

rschwieb
  • 153,510