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

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)=[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 2 — Rotate at origin

Rotate around the origin.

R=[010100001]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)=[013101001]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=[013101001][111]=[01+(1)1+3111+01+(1)101+01+11]=[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=[013101001][311]=[03+(1)1+3113+01+(1)103+01+11]=[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=[013101001][121]=[01+(1)2+3111+02+(1)101+02+11]=[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'
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).