I want to find the rotations needed to rotate one unit vector into another unit vector and then use these rotations to rotate a 3x3 matrix.
For example: I want to determine the rotations needed to rotate [1 0 0] into [-0.342, -0.938, 0.0566] and apply the same rotation to the matrix M =
(1 0 0)
(0 2 0)
(0 0 3)
The way I've thought of doing this is to:
1. Rotate [1 0 0] about the z-axis by the angle arctan( \frac{0.938}{0.342} ) to get [-0.3425 -0.9395 0]. Apply the same rotation to M.
2. Take the cross product between [-0.3425 -0.9395 0] and [-0.342 -0.938 0.0566] to get a new axis of rotation \hat{r}.
3. The new angle of rotation should be \hat{\theta} = arctan(\frac{0.0566}{\sqrt{0.3425^{2} + 0.9395^{2}}}).
4. Apply Rodriguez's rotation formula by \hat{\theta} about \hat{r} to M
I hope it's clear what I'm trying to do. If anyone can confirm that I'm doing this correctly, or come up with a better way of doing this, I'd very much appreciate it.
Thanks!
pkleinod
Jul12-08, 07:16 AM
Hello and welcome to PF!
To rotate one vector into another one, you
need only a single rotation in the plane containing the two vectors.
Here is a general method of finding such a single rotation.
The angle of rotation is a
bivector whose direction specifies the plane of rotation and whose
magnitude specifies how much to rotate.
Let a and b be two unit vectors in 3D space.
Since any unit vector multiplied by itself is just equal to the
square of its magnitude, a^2=b^2=1 , so it follows that
a = ab^2 = (ab) b = (a \cdot b + a \wedge b) b.
i.e. the geometric product ab rotates the vector b
into the vector a . The product may be written in terms of the
angle of rotation, the bivector \mathbf A .
Write {\mathbf A} = \mid {\mathbf A} \mid \widehat{\mathbf A} , where
\mid {\mathbf A}\mid is the magnitude of the
rotation angle and \widehat{\mathbf A} is the unit
bivector specifying the plane of rotation. Using the fact that
\widehat{\mathbf A}^2 = -1 , the product can be expressed as
ab = e^{\mathbf A}= \cos{\mathbf A} + \sin{\mathbf A}.
ab = \cos{\theta} + \widehat{\mathbf A } \sin{\theta}.
It only remains to identify the scalar and bivector parts of this with
a\cdot b and a\wedge b (which you know) in order
to get the sine and cosine of the rotation angle and the plane of
rotation.
Any vector in the rotation plane, \widehat{\mathbf A} ,
may therefore be rotated through the angle \theta by
pre-multiplying it with the geometric product ab . Any
vector perpendicular to this plane remains unaltered by this
multiplication; hence, to rotate some arbitrary vector x in the same
way that you rotated the vector b , you must first find
its components parallel and perpendicular to the plane of rotation:
x = x_\parallel + x_\perp
The rotated vector is then
x' = x_\perp + ab x_\parallel .
You can get the two components from
x_\parallel = (x\cdot \widehat{\mathbf A})\widehat{\mathbf A}^{-1}
There is an alternative way to rotate an arbitrary vector. Let
R = \cos{\theta/2} + \widehat{\mathbf A} \sin{\theta/2}
R^\dagger = \cos{\theta/2} - \widehat{\mathbf A } \sin{\theta/2}
The rotated vector is then
x' = R^\dagger x R
.
That's it, but it may be useful to spell this out somewhat. Let
{e_1,e_2,e_3} be a set of orthonormal vectors spanning the
space. These have the properties e_i^2=1
and e_i e_j = -e_j e_i . The unit vectors defining the rotation
are then
a = a_1e_1 + a_2e_2 + a_3e_3
b = b_1e_1 + b_2e_2 + b_3e_3
The dot product and wedge products are
a\cdot b = a_1b_1 + a_2b_2 + a_3b_3 = \cos{\theta}
where A_3=a_1b_2 - a_2b_1 , with similar expressions for
A_1 and A_2 . The magnitude of the bivector
\mathbf A is
\mid {\mathbf A} \mid = \sqrt{A_1^2+A_2^2 + A_3^2}=\sin{\theta}
and the unit plane of rotation is