3
$\begingroup$

Given angles (in degrees) to rotate around, $x$-, $y$-, $z$-axis how does one come up with the rotation matrix? For example if you have a point $p$ represented by a vector, how do you rotate it by multiplying it with a matrix $A$ so $p = Ap$.

From Wikipedia:

A basic rotation (also called elemental rotation) is a rotation about one of the axes of a coordinate system. The following three basic rotation matrices rotate vectors by an angle $\theta$ about the $x$, $y$, or $z$ axis, in three dimensions:

$$R_{x}(\theta)=\left[\begin{array}{ccc}1 & 0 & 0 \\ 0 & \cos \theta & -\sin \theta \\ 0 & \sin \theta & \cos \theta\end{array}\right]$$ $$R_{y}(\theta)=\left[\begin{array}{ccc}\cos \theta & 0 & \sin \theta \\ 0 & 1 & 0 \\ -\sin \theta & 0 & \cos \theta\end{array}\right]$$ $$R_{z}(\theta)=\left[\begin{array}{cc}\cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1\end{array}\right]$$

I'm a little unclear. So you need a different rotation matrix for each one of the axis? Is there a way just to get one rotation matrix that covers the rotations done to each axis? Am I even reading this right, so $R_x(\theta)$ is the matrix used to perform the rotation about the $x$-axis for $\theta$ degrees?

$\endgroup$
2

2 Answers 2

2
$\begingroup$

If $R_x$ rotates around the $x$-axis, and $R_y$ rotates around the $y$-axis, and you want to rotate first around $x$, and then around $y$, simply apply $R_y R_x$ to your vector, let's call it $v$.

This is because $R_x v$ rotates $v$ around the $x$-axis, then $R_y(R_x v)$ rotates $R_x v$ around the $y$-axis.

$\endgroup$
4
  • $\begingroup$ Since matrix multiplication is associative I can just multiply $R_yR_x$ and multiply the resulting matrix by the vector, right? $\endgroup$
    – Celeritas
    Jan 26, 2014 at 0:29
  • $\begingroup$ Yes, indeed!${}{}$ $\endgroup$
    – Emily
    Jan 26, 2014 at 1:36
  • $\begingroup$ then angle theta changes for each one of the rotation matrices, right? rotating 45 deg around x-axis and 90 deg around y-axis then the theta used in cos and sin for $R_x$, $R_y$ and $R_z$ are different, right? $\endgroup$
    – Celeritas
    Jan 28, 2014 at 9:39
  • $\begingroup$ Yes... $R_x(\theta)$, $R_y(\phi)$, $R_z(\psi)$, etc... $\endgroup$
    – Emily
    Jan 28, 2014 at 15:36
1
$\begingroup$

The easiest way is to think in polar coordinates. I'll do a case in $\mathbb{R}^2$..

Let $P = (x,y)$, and $P_\varphi = (x_\varphi, y_\varphi)$ the same point rotated by $\varphi$ degrees (or radians, whatever). We write $x = r \cdot \cos \theta$ and $y = r \cdot \sin \theta$, where $\theta$ is the angle formed between the vector $\vec{OP}$ and the $x$ axis, and $r$ is the distance of $P$ to the origin. Now, we have $P = (r \cdot \cos \theta, r \cdot \sin \theta)$. It should be intuitive now that $$P_\varphi = (r \cdot \cos(\theta + \varphi), r \cdot \sin(\theta + \varphi))$$ Using the formulas for angle addition, follows that $$P_\varphi = (r \cdot (\cos\theta \cdot \cos\varphi - \sin\theta \cdot \sin \varphi), \hspace{3pt} r \cdot (\sin\theta \cdot \cos \varphi + \cos \theta \cdot \sin \varphi)) \\ P_\varphi = (r \cdot \cos\theta \cdot \cos\varphi - r \cdot \sin\theta \cdot \sin \varphi, \hspace{3pt} r \cdot \sin \theta \cdot \cos \varphi + r \cdot \cos \theta \cdot \sin \varphi) \\ P_\varphi = (x \cdot \cos \varphi - y \cdot \sin\varphi, \hspace{3pt} y \cdot \cos \varphi + x \cdot \sin \varphi)$$

So, basically, we apply this last formula to the points $(1,0)$ and $(0,1)$. Denoting by $T_\varphi(x,y)$ the rotation, we get $T_\varphi(1,0)= (\cos \varphi, \sin \varphi)$ (this will be the first column!), and $T_\varphi(0,1) = (- \sin \varphi, \cos \varphi)$ (this is the second column!). I'm having trouble to write the matrix here, but I hope you got the idea.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .