Re: [Algorithms] Rotation Matrices
Brought to you by:
vexxed72
|
From: Charles B. <cb...@cb...> - 2000-08-02 23:14:26
|
Actually, the fact that rotations in 2d are commutative
and rotations in 3d are not is quite a deep fact. It's
why we have fermions, so that all of us are solid objects,
not collapsed in some big degenerate bose condensate.
In 2d, the rotation group is equivalent to U(1), that is
the unitary group in 1d. This is because a rotation in 2d
about the origin has the rule :
R(a)R(b) = R(a+b)
Which obviously implies commutation :
R(a)R(b) - R(b)R(a) = R(a+b) - R(a+b) = 0
[X,Y] = XY - YX
is the commutator. When [X,Y] = 0 it means two
variables commute.
It also means that a valid group representation is the
complex exponential :
R(a) = e^(ia) = cos(a) + isin(a)
since
R(0) = 1 (the do-nothing operator is the identity)
R(2pi) = 1
which is also true for the complex exponential, and
obviously :
R(a)R(b) = e^(ia) e^(ib) = e^(i(a+b)) = R(a+b)
Some neat notes in 2d that will get you in the right
mind-set. A rotation by 180 is the same as multiplying
by (-1), that is, it's an inversion, which the U(1)
form e^(i pi) = -1 confirms. Also, we can see that
rotation by 180 must be (-1), since if you do it twice
(square it) then you must get 1, the identity. Similarly,
rotation by 90 is (i), since if you do it twice you must
get a rotation by 180, which is (-1). If you think of the
plane as a complex plane, you can easily confirm that
multiplying by pi takes (x+iy) to (ix-y), which is indeed
the 2d matrix
0 -1
1 0
which is a rotation by 90, and is the 2d real form of "i",
it's a square-root of minus one (it's also a Pauli Spin
matrix, but now we're getting ahead of ourselves!).
Now, in 3d, we have three axes. We'll try to write this
in the complex exponential form again. We write
Rx(a) = e^(a Jx)
similarly for x,y,z. The J's are the "generators" of the
group. The Jx is a 3x3 matrix, and the identity here is
the 3x3 identity. We know what a rotation by X needs to
be, so we can figure out the Jx quite easily.
Jx =
0 0 0
0 0 1
0 -1 0
Jy =
0 0 -1
0 0 0
1 0 0
Jz =
0 1 0
-1 0 0
0 0 0
So Rx(a) = = {1 in the xx, and cos(a) in the yy and zz} + sin(a) Jx
= 1xx + cos(a) * Jx^2 + sin(a) Jx
which follows since
-Jx^2 =
0 0 0
0 1 0
0 0 1
= {1 - 1xx}
We get the cos/sin version of R by actually expanding out the exponential
using its Taylor series polynomial and doing the matrix multiplies :
e^x = 0 + x + x^2/2 + ... x^n/n!
These J's are cute; they're actually the "basis" of the
3x3 antisymmetric matrices, and you should all know that
antisymmetric matrices is what rotations are all about.
In fact, rotations are the SO(n) group or orthonormal
matrices. What I said earlier about U(1) is the statement
that SO(2) = U(1). The quaternion-rotation matrix
corresponds state that SO(3) = SU(2) * Z2 , where the Z2
is the damned "Gimbal Lock", which is frequently said
as "SU(2) is a double-cover of SO(3)"; eg. in SU(2),
if you rotate by 2pi, you get a minus sign in there which
wasn't there before; you have to rotate by 4pi to get
the identity; this is the double-cover; this double-cover
corresponds to the two matrices in SO(3) which give
you the same rotation : rotation by theta around n, and
rotation by (2pi-theta) around -n (confining the angles
to be in (0,2pi)).
These J's are actually a 3x3 matrix representation of the
quanternions, BTW, since :
[Jx,Jy] = JxJy - JyJx = - Jz
In fact
[Ji,Jj] = - Eijk Jk
where Eijk is the "antisymmetric tensor",
(Eijk = 1 if ijk is a cyclic permutation of xyz,
and -1 if it's anti-cyclic, and 0 otherwise.
eg. Exyz = 1, Eyxz = -1, Exxy = 0)
Which is the multiplication rule for the quaternion
basis (in commutator form). (The quaternion bases
are also equal to the rotations by pi times i; that
is
I = i Rx(pi)
J = i Ry(pi)
K = i Rz(pi)
so that I K = - K and so on, which you can varify by
matrix multiplication, and I^2 = -1, etc.)
Some of you may be familiar with the J's ; they're used
in going from a quaternion to a matrix.
In fact, if you have a quaternion q = {w,x,y,z} then the
matrix equivalent is M(q) with M(q) = L * R (here M,L
and R are all 4x4), and
L =
J*q -x
-y
-z
x y z -w
R =
J*q x
y
z
-x-y-z-w
Where J*q is a 3x3 matrix created by treating J as a 4-vector
of matrices and doing the 4-dot product :
J = { 1 , Jx, Jy, Jz }
(and there's a (-1) in the 4-dot product on the 0th component :
V*W = -VwWw + VxWx + VyWy + VzWz )
The generators, J, are actually the infinitesimal rotations.
That is,
Rx(a) = lim(N->infinity) { (1 + a Jx/N)^N }
Obviously,
Rx(a) ~= (1 + a Jx)
when a is very small. This is actually a good way to derive
the rotation matrices, starting from that infinitesimal
rotation (which is easy to derive by looking at what a vector
does when you rotate it a tiny bit; a tiny rotation is just
a linear transformation). You then just exponentiate it like
the limit above, which gives you the exponential, which then
leads the sine and cosine!
Anyway, we've seen that the generators, J, don't commute, which
means that the rotations can't commute. We'll use a convenient
form for the rotation matrices :
Rx(a) = 1xx + cos(a) * Jx^2 + sin(a) Jx
= (1 - cos(a)) * 1xx + cos(a) + sin(a) Jx
[Rx(a),Ry(b)] = [ sin(a) Jx , sin(b) Jy ]
All the other terms have dropped out, since they are diagonal
matrices, and a diagonal matrix commutes with all matrices.
So
[Rx(a),Ry(b)] = sin(a) sin(b) [Jx,Jy] = - sin(a) sin(b) Jz
So, for example
[Rx(pi),Ry(pi)] = 0
and
[Rx(pi/2),Ry(pi/2)] = - Jz
In fact, it should be obvious that this commutator is equal to
zero, because it obviously must be zero whenever a or b is an
integer multiple of pi, and it must increase and decrease
smoothly around those points, so naturally we should have guessed
that form.
Anyway, the point is that if I rotate a vector in x then y, and I
rotate it in y then x, and take the difference, that difference is
"like" a rotation in Z.
Note Rx(pi/2) = 1xx + Jx
so Jz = (Rz(pi/2) - 1zz)
A rotation in Z by 90, projected onto the XY plane, that is,
the perpendicular of the projection of the vector in the XY plane.
For more jazz like this, see
http://math.ucr.edu/home/baez/README.html
or
http://www-physics.lbl.gov/~rncahn/book.html
and search the net for Lie Algebras and Rotations Groups such.
--------------------------------------
Charles Bloom www.cbloom.com
|