Waste less time on Facebook — follow Brilliant.
×

Rotation in 3D - The Rotation Matrix

In this note, I investigate the rotation matrix that relates the image of a point \( \vec{p} \) when it is rotated by an angle \( \theta \) about an axis \( \vec{a} \) that passes through the origin.

Without loss of generality, we assume that the direction vector of the axis is a unit vector.

Now we decompose the vector \( \vec{p} \), into two components, one along the rotation axis, and one orthogonal to it.

The component along the rotation axis is given by

\[ \vec{p_a} = ( \vec{p} . \vec{a} ) \vec{a} \]

(remember that \( \vec{a} \) is a unit vector so, \( \vec{a} \cdot \vec{a} = 1 \)

And, the orthogonal component is,

\[ \vec{p_n} = \vec{p} - \vec{p_a} = \vec{p} - ( \vec{p} \cdot \vec{a} ) \vec{a} \]

In matrix-vector notation, if all vectors are (3 x 1) column vectors, then

\[ \vec{p_a} = (\vec{p} \cdot \vec{a}) \vec{a} = (\vec{a} \cdot \vec{p}) \vec{a} = (\textbf{a}^T \textbf{p}) \textbf{a} = \textbf{a} (\textbf{a}^T \textbf{p}) = (\textbf{a} \textbf{a}^T) \textbf{p} \]

and

\[ \vec{p_n} = \vec{p} - \vec{p_a} = ( \textbf{I} - \textbf{a} \textbf{a}^T ) \textbf{p} \]

Now when the component \( \textbf{p}_a \) undergoes rotation, it is unchanged.

It is \( \textbf{p}_n \) that gets rotated about the axis \( \textbf{a} \). To write an expression for the image of \( \textbf{p}_n \) undergoing a rotation by \( \theta \) , we need the perpendicular vector to both \( \textbf{a} \) and \( \textbf{p}_n \), and is at \( 90 \) degrees counter-clockwise from \( \textbf{p}_n \). This vector is

\[ \vec{u_n} = \vec{a} \times \vec{p_n} = \vec{a} \times (\vec{p} - \vec{p_a}) = \vec{a} \times \vec{p} \]

because \( \vec{a} \times \vec{p_a} = 0 \) since the two vectors are collinear.

Noe that \( || \vec{u_n} || = || \vec{a} \times \vec{p_n} || = || \vec{p_n} || \) because \( \vec{a} \) is orthogonal to \( \vec{p_n} \) and \( \vec{a} \) is a unit vector.

So now the plane of rotation is spanned by the vectors \( \vec{p_n} \) and \( \vec{u_n} \), both equal in length , and that length is \( || \vec{p_n} || \)

With that in mind, and since the point describes a circle in the plane of rotation, then

\[ \vec{p_n} ' = \cos(\theta) \vec{p_n} + \sin(\theta) \vec{u_n} \]

this expresses the rotation of the normal component of \( \vec{p} \) around the axis \( \vec{a} \).

Therefore, the rotated vector is

\[ \vec{p} ' = \vec{p_a} + \vec{p_n} ' = \vec{p_a} + \cos(\theta) \vec{p_n} + \sin(\theta) \vec{u_n} = \vec{p_a} + \cos(\theta) \vec{p_n} + \sin(\theta) (\vec{a} \times \vec{p} ) \]

Using the expressions derived above, we arrive at

\[ \textbf{p} ' = (\textbf{a} \textbf{a}^T) \textbf{p} + \cos(\theta) (\textbf{I} - \textbf{a} \textbf{a}^T) \textbf{p} + \sin(\theta) (\textbf{a} \times \textbf{p}) \]

Now,

\[ \textbf{a} \times \textbf{p} = \textbf{S}_a \textbf{p} \]

where \( \textbf{S}_a \) is a 3 x 3 skew-symmetric matrix given by

\[ \textbf{S}_a = \begin{bmatrix} 0 & -a_z & a_y \\ a_z & 0 & -a_x \\ -a_y & a_x & 0 \end{bmatrix} \]

(that is, the vector cross product \( \textbf{a} \times \textbf{p} \) , can be expressed as a matrix-vector multiplication)

and hence, finally,

\[ \textbf{p}' = \textbf{R} \textbf{p} \]

where

\[ \textbf {R} = \textbf{a} \textbf{a}^T + \cos(\theta) ( I - \textbf{a} \textbf{a}^T ) + \sin(\theta) \textbf{S}_a \]

is the desired rotation matrix.

What if the axis of rotation did not pass through the origin, but passed though a point \( \textbf{p}_0 = [x_0, y_0, z_0] \) ?

In this case, we can translate (shift) the origin of the reference frame to the point \( \textbf{p}_0 \). Since \( \textbf{p}_0 \) is on the axis of rotation it is unaffected by the rotation, and its image is itself. Then, we apply our result to the vector \( (\textbf{p} - \textbf{p}_0) \) which joins the axis of rotation at the point \( \textbf{p}_0 \).

Therefore,

\[ \textbf{p} ' = \textbf{p}_0 + \textbf{R} ( \textbf{p} - \textbf{p}_0) \]

Note by Hosam Hajjir
2 years, 1 month ago

No vote yet
1 vote

Comments

Sort by:

Top Newest

nice work! you have solved something which is easy to imagine hard to solve but i didn't get the matrix step how did you use the transpose part. i am a novice at linear algebra so please explain in little simpler terms Srivats Anshumaali · 1 year, 9 months ago

Log in to reply

@Srivats Anshumaali I am sorry, I cannot make it any simpler. I suggest you wait till you've gained a working experience with Linear Algebra, then revisit this note, but thanks for the complement. Hosam Hajjir · 1 year, 9 months ago

Log in to reply

×

Problem Loading...

Note Loading...

Set Loading...