# Rotating a vector abut a new origin

Discussion in 'Undergraduate Math' started by wrdeever, Jan 13, 2011.

1. ### wrdeeverGuest

Even if you don't know LaTeX, you can probably understand my notation.

To start with, let's assume that the origins coincide. Then the
transform is just a rotation. Let's name the unit direction vectors of
each frame as g_1, g_2, and g_3 and p_1, p_2, and p_3. Then a vector
q_p in the purple frame is rotated to the vector q_g in the green
frame by the rule q_g = R q_p, where R is the rotation matrix whose i-
th column is p_i written as a vector in the green frame, i.e. ,
R_{row,col} = the g_{row} coordinate of p_{col}.

You probably have the rotation expressed as two rotations in sequence.
First rotate by \alpha in the green 1-2 plane (1 towards 2 is a
positive rotation), yielding let's say the yellow frame. Then rotate
\beta in the yellow 2-3 plane (2 towards 3 being positive). If you're
a pilot, think of \alpha as yaw and \beta as pitch.

So we can write a rotation vector R_1 from green to yellow by using
the plane rotation rules (see the CRC tables, p 515 in the 14th ed,
for instance): (x,y) rotated by \theta to (x',y') is
x' = x \cos{\theta} + y \sin{\theta} and y' = y \cos{\theta} - x
\sin{\theta}, which makes R_1

\cos{\alpha} \sin{\alpha} 0

-\sin{\alpha} \cos{\alpha} 0

0 0 1

and an R_2 from yellow to purple by a \beta rotation is

1 0 0

0 \cos{\beta} \sin{\beta}

0 -\sin{\beta} \cos{\beta}

We want to multiply R_1 and R_2 to get R, but which way?
We want green = R purple, so that indicates that we take it in steps

yellow = (R_2^T) purple
green = (R_1^T) yellow = (R_1^T) (R_2^T) purple = (R_2 R_1)^T purple

I'm using the fact that for a rotation matrix, the inverse is
identical to the transpose.

Now to go from green to purple

purple = [ (R_2 R_1)^T]^T green = (R_2 R_1) green

So R = R_2 R_1. I'll leave it to you to multiply the matrices.

From you post, it seems you have the purple origin expressed as a
vector in the green frame, let's call it O. Imagine a red frame with
axes parallel to the green axes, but centered at O.
Now q_r = q_g - O and so finally q_p = R q_r = R (q_g - O).

I notice that I changed my notation a bit as I went along, so I hope
this is not too muddled for you. Rereading your post, you may already
have the elements of R, so perhaps the digression on composing two
rotations is irrelevant, but I'll leave it in in case it illuminates a
point or two. Regards.

wrdeever, Jan 13, 2011