Rotate a triangle about a chosen pivot using a translated coordinate system.

rotate-about-a-point To rotate about a pivot p, translate p to the origin, rotate, then translate back. The composite is T(p) R T(-p).

Example

Rotate around a chosen pivot with T(p) R T(-p).

highlighted = computed this step

Step 1 — Move pivot to origin

Translate the pivot to the origin.

T(−p)=[10−201−1001]T(-p)=\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.P

Step 2 — Rotate at origin

Rotate around the origin.

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

Step 3 — Move pivot back

Translate the pivot back.

T(p)=[102011001]T(p)=\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.P

Step 4 — Compose

Compose T(p) R T(-p).

T(p)RT(−p)=[0−1310−1001]T(p) R T(-p)=\begin{bmatrix}0&-1&3\\1&0&-1\\0&0&1\end{bmatrix}
Homogeneous transform plotA dim original triangle and transformed vertices computed from homogeneous matrices.P

Step 5 — Rotate vertex A

Move vertex A with the matrix.

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

Step 6 — Rotate vertex B

Move vertex B with the matrix.

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

Step 7 — Rotate vertex C

Move vertex C with the matrix.

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

Step 8 — 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.PA'B'C'