# Change from one cartesian co-ordinate system to another by translation and rotation.

There are two reasons for me to ask this question:

1. I want to know if my understanding on this issue is correct.
2. To clarify a doubt I have.

I want to change the co-ordinate system of a set of points (Old cartesian coordinates system to New cartesian co-ordinate system). This transformation will involve Translation as well as Rotation. This is what I plan to do:

(Kindly refer to the image attached here )

With respect to this image I have a set of points which are in the XYZ coordinate system (Red). I want to change it with respect to the axes UVW (Purple). In order to do so, I have understood that there are two steps involved: Translation and Rotation.

When I translate, I only change the origin. (say, I want the UVW origin at (5,6,7). Then, for all points in my data, the x co-ordinates will be subtracted by 5, y by 6 and z by 7. By doing so. I get a set of Translated data.)

Now I have to apply a rotation transform (on the Translated data). The Rotation matrix is shown in the image. The values Ux, Uy and Uz are the co-ordinates of a point on the U axis which has unit distance from origin. Similarly, the values Vx, Vy and Vz are the coordinates of a point on the V axis which has a unit distance from origin. (I want to know if I am right here.)

Given this information, how can I calculate the value of Wx, Wy and Wx (a point lying on the W axis with unit distance from the origin)? I will know the co-ordinates of the origin {Obviously, (0,0,0), and I have the co-ordinates of points lying at unit distance from origin on the U and V axes. Also, U, V an W are orthonormal.} How can I calculate the 3rd row of rotation matrix R?

Is my approach correct? My ultimate goal is to transform the co-ordinate system. I can calculate points on the U and V axes, but not on the W axis. Keeping this in mind, please provide me with inputs.

(As far as I know, with the Point U (Ux, Uy, Uz), Point V (Vx, Vy and Vz) and the origin, I can define a plane. With this, I can find a point which is at unit distance from (0, 0, 0) in a direction along the plane's normal. How should I do this?)

(Also, if it serves any purpose, I would like to let you know that I am using MATLAB.)

• Your link does not work anymore. – eddie Jan 30 '18 at 16:37
• @Saania, Yes, could you please upload the image directly in here? – Simon Oct 26 '18 at 8:54

This question is somewhat related to this question, with the main difference that you also have an translation.

Lets first make sure that the notation is clear:

A vector $\vec{v}$ can be represented in the initial Cartesian coordinate system as,

$$\vec{v} = \begin{bmatrix} \vec{e}_x \\ \vec{e}_y \\ \vec{e}_z \end{bmatrix} \cdot \begin{bmatrix} v_x \\ v_y \\ v_z \end{bmatrix} = v_x \vec{e}_x + v_y \vec{e}_y + v_z \vec{e}_z,$$

where $\vec{e}_x$, $\vec{e}_y$ and $\vec{e}_z$ are the orthonormal basis vectors of the initial Cartesian coordinate system.

Similar, the vector $\vec{v}$ can also be represented in the new Cartesian coordinate system as,

$$\vec{v} = \begin{bmatrix} \vec{e}_u \\ \vec{e}_v \\ \vec{e}_w \end{bmatrix} \cdot \begin{bmatrix} v_u \\ v_v \\ v_w \end{bmatrix} + \vec{o} = (v_u + o_u) \vec{e}_u + (v_v + o_v) \vec{e}_v + (v_w + o_w) \vec{e}_w,$$

where $\vec{o}$ is the vector connecting the initial and new origin and $\vec{e}_u$, $\vec{e}_v$ and $\vec{e}_w$ are the orthonormal basis vectors of the new Cartesian coordinate system, however these can be written as a linear combination of the basis vectors of the initial Cartesian coordinate system,

$$\vec{e}_u = e_{ux} \vec{e}_x + e_{uy} \vec{e}_y + e_{uz} \vec{e}_z,$$

$$\vec{e}_v = e_{vx} \vec{e}_x + e_{vy} \vec{e}_y + e_{vz} \vec{e}_z,$$

$$\vec{e}_w = e_{wx} \vec{e}_x + e_{wy} \vec{e}_y + e_{wz} \vec{e}_z.$$

If $e_{wx}$, $e_{wy}$ and $e_{wz}$ are unknown you can find it by taking the cross product. Assuming that the initial basis vectors are right-handed, then $\vec{e}_w$ can be found with,

$$\vec{e}_w = \vec{e}_u \times \vec{e}_v = (e_{uy}e_{vz} - e_{uz}e_{vy}) \vec{e}_x + (e_{uz}e_{vx} - e_{ux}e_{vz}) \vec{e}_y + (e_{ux}e_{vy} - e_{uz}e_{vx}) \vec{e}_z,$$

The rotation of the basis vectors can be calculated with the help of the rotation matrix and can be found with the help of dyadic products,

$$R = \vec{e}_u\vec{e}_x + \vec{e}_v\vec{e}_y + \vec{e}_w\vec{e}_z,$$

this yields a second order tensor. In order to calculate the rotation you would have to take the dot product, but if you instead of dyadic products use vector direct products you can use a normal matrix-vector multiplication. In MATLAB this would can be done with,

R = eu * ex' + ev * ey' + ew * ez';


such that,

$$\begin{bmatrix} v_u \\ v_v \\ v_w \end{bmatrix} = R \begin{bmatrix} v_x \\ v_y \\ v_z \end{bmatrix} + \begin{bmatrix} o_u \\ o_v \\ o_w \end{bmatrix}.$$