Main question

Let ($x_p$, $y_p$, $z_p$) be the initial coordinates of a point $P$ on a rigid body in a right-handed 3D Euclidean space. Let ($x_r$, $y_r$, $z_r$) be the coordinates of a center of rotation $R$. Let $\psi$, $\theta$ and $\phi$ be rotations along axes parallel to the z-axis, y-axis and x-axis respectively. If I apply firstly a rotation $\psi$, then a rotation $\theta$ and lastly a rotation $\phi$ on the rigid body about point $R$, what will be the new coordinates of the point $P$?

Follow-up question

Let's say I have the coordinates of a large yet finite number of points defined on the surface of a rigid body stored in a 1D array in the following manner: [x1, y1, z1, ..., xn, yn, zn]. What is the most efficient algorithm to compute their new coordinates after a rotation as defined in the Main question?

Answer Thanks to mike I was pointed in the right direction. A pseudo-code to compute the rotation matrix as needed in his answer is the following:

function rotation_matrix_3d(psi, theta, phi)
    rotMat = [cos(theta)*cos(psi)                            -cos(theta)*sin(psi)                           sin(theta);
              cos(phi)*sin(psi)+sin(phi)*sin(theta)*cos(psi) cos(phi)*cos(psi)-sin(phi)*sin(theta)*sin(psi) -sin(phi)*cos(theta);
              sin(phi)*sin(psi)-cos(phi)*sin(theta)*cos(psi) sin(phi)*cos(psi)+cos(phi)*sin(theta)*sin(psi) cos(phi)*cos(theta)]

    return rotMat

1 Answer 1


Let $\vec{v}_p=(x_p,y_p,z_p)$ and $\vec{v}_r=(x_r,y_r,z_r)$. Denote $\vec{v}_{p'}=(x_{p'},y_{p'},z_{p'})$ the coordinates of P after rotation.

Then we have: $$(\vec{v}_{p'}-\vec{v}_r)=R_x(\phi)R_y(\theta)R_z(\psi)(\vec{v}_{p}-\vec{v}_r)$$

So $$\vec{v}_{p'}=\vec{v}_r+R_x(\phi)R_y(\theta)R_z(\psi)(\vec{v}_{p}-\vec{v}_r)$$

  • $\begingroup$ So you multiply the difference between the point and the rotation center by three rotation matrices. How does the compacted matrix look like? $\endgroup$ Commented Jun 22, 2014 at 14:39
  • $\begingroup$ you may multiply them together. you may also refer to [1]:en.wikipedia.org/wiki/Rotation_matrix $\endgroup$
    – mike
    Commented Jun 22, 2014 at 15:10

You must log in to answer this question.

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