# Transformation Matrices – Direct 3D Translations

## Transformation Matrices – Direct 3D Translations

So again a big thank you to Catarina Carvalheiras were going to carry on from the Direct 2D Translations but this time in the 3D space. Which is only adding one more row to the matrix, so this should be quick and easy.

So here is our problem;

So what do we know, we know that we need to add one more dimension to our problem so in the transformation matrix we will add one more row for Z, we also know there is no rotation between the two reference frames so the identity matrix can be used for the three vectors [t11,t21,t31}, [t12,t22,t32], and [t13,t23,t33]. We also know that [t14,t24,t34] = [-10,-20,15] and [x0,y0,z0] = [-6,10,5] so we should be able to plug in the numbers and get a result

\begin{gather*}

P|_1 = [T] \cdot P|_0 \\

\begin{bmatrix}
x_1 \\
y_1 \\
z_1 \\
1
\end{bmatrix}
= \begin{bmatrix}
t_{11} &   t_{12} & t_{13} & t_{14} \\
t_{21} &   t_{22} & t_{23} & t_{24}\\
t_{31} &   t_{32} & t_{33} & t_{34}\\
0 &   0 & 0 & 1\\
\end{bmatrix}
\cdot
\begin{bmatrix}
x_0 \\
y_0 \\
z_0 \\
1
\end{bmatrix} \\
\lbrack 4 \times1 \rbrack = \lbrack 4 \times4 \rbrack \cdot  \lbrack 4 \times 1 \rbrack

\end{gather*}

So let’s see what we get.

\begin{gather*}

\begin{bmatrix}
x_1 \\
y_1 \\
z_1 \\
1
\end{bmatrix}
= \begin{bmatrix}
1 &  0 & 0 & -10 \\
0 &  1 & 0 & -20 \\
0 &  0 & 1 & 15 \\
0 &   0 & 0 & 1\\
\end{bmatrix}
\cdot
\begin{bmatrix}
-6 \\
10 \\
5 \\
1
\end{bmatrix} \\

x_1 = (1 * -6) + (0*10) + (0*5) + (-10*1) \\
x_1 = (-6) + 0 + 0 +(-10) \\
\bold{x_1 =-16} \\

y_1 = (0*-6)+(1*10)+(0*5)+(-20*1) \\
y_1 = 0 + 10 + 0 + (-20) \\
\bold{y_1 = -10} \\

z_1 = (0*-6)+(0*10)+(1*5)+(15*1) \\
z_1 = 0 + 0 + 5 +15 \\
\bold{z_1 = 20} \\

1 = (0*-6)+(0*10)+(0*5)+(1*1) \\
1 = 0+0+0+1 \\
\bold{1 =1} \\
\end{gather*}

We know this is correct if we do the mental math, the delta between the two refence frames is [-10,-20,15] and the point location is [-6,10,5]. If we add them together (-10 + -6) , (-20 + 10) , (15 + 5) we get [-16,-10,20]. 🙂