Use a 3x3 homogeneous matrix to translate every vertex of a triangle.

translate-as-matrix In homogeneous coordinates, translation is a matrix multiplication. The result matches vector addition from the earlier translation lesson.

Example

Use a 3x3 homogeneous matrix to translate a triangle.

highlighted = computed this step

Step 1 — Set up

Use the homogeneous matrix; translation is matrix multiplication now.

M=[10201−1001]M=\begin{bmatrix}1&0&2\\0&1&-1\\0&0&1\end{bmatrix}
Homogeneous transform plotA dim original triangle and transformed vertices computed from homogeneous matrices.

Step 2 — Move vertex A

Translate vertex A with the matrix.

A′=[10201−1001][111]=[1⋅1+0⋅1+2⋅10⋅1+1⋅1+(−1)⋅10⋅1+0⋅1+1⋅1]=[301]\begin{aligned}A'&=\begin{bmatrix}1&0&2\\0&1&-1\\0&0&1\end{bmatrix}\begin{bmatrix}1\\1\\1\end{bmatrix}\\&=\begin{bmatrix}1\cdot1+0\cdot1+2\cdot1\\0\cdot1+1\cdot1+\left(-1\right)\cdot1\\0\cdot1+0\cdot1+1\cdot1\end{bmatrix}\\&=\hlmath{\begin{bmatrix}3\\0\\1\end{bmatrix}}\end{aligned}
Homogeneous transform plotA dim original triangle and transformed vertices computed from homogeneous matrices.A'

Step 3 — Move vertex B

Translate vertex B with the matrix.

B′=[10201−1001][311]=[1⋅3+0⋅1+2⋅10⋅3+1⋅1+(−1)⋅10⋅3+0⋅1+1⋅1]=[501]\begin{aligned}B'&=\begin{bmatrix}1&0&2\\0&1&-1\\0&0&1\end{bmatrix}\begin{bmatrix}3\\1\\1\end{bmatrix}\\&=\begin{bmatrix}1\cdot3+0\cdot1+2\cdot1\\0\cdot3+1\cdot1+\left(-1\right)\cdot1\\0\cdot3+0\cdot1+1\cdot1\end{bmatrix}\\&=\hlmath{\begin{bmatrix}5\\0\\1\end{bmatrix}}\end{aligned}
Homogeneous transform plotA dim original triangle and transformed vertices computed from homogeneous matrices.A'B'

Step 4 — Move vertex C

Translate vertex C with the matrix.

C′=[10201−1001][121]=[1⋅1+0⋅2+2⋅10⋅1+1⋅2+(−1)⋅10⋅1+0⋅2+1⋅1]=[311]\begin{aligned}C'&=\begin{bmatrix}1&0&2\\0&1&-1\\0&0&1\end{bmatrix}\begin{bmatrix}1\\2\\1\end{bmatrix}\\&=\begin{bmatrix}1\cdot1+0\cdot2+2\cdot1\\0\cdot1+1\cdot2+\left(-1\right)\cdot1\\0\cdot1+0\cdot2+1\cdot1\end{bmatrix}\\&=\hlmath{\begin{bmatrix}3\\1\\1\end{bmatrix}}\end{aligned}
Homogeneous transform plotA dim original triangle and transformed vertices computed from homogeneous matrices.A'B'C'

Step 5 — Result

The transformed triangle is complete.

transformed triangle complete\text{transformed triangle complete}
Homogeneous transform plotA dim original triangle and transformed vertices computed from homogeneous matrices.A'B'C'