Translating a point with homogeneous coordinates \((x, y, w)\) by a vector \((\Delta x, \Delta y, 0)\) can be computed using the following matrix multiplication:
\[\begin{bmatrix}
1 & 0 & \Delta x \\
0 & 1 & \Delta y \\
0 & 0 & 1 \\
\end{bmatrix}
\cdot
\begin{bmatrix}
x \\
y \\
w \\
\end{bmatrix}\]
Note that translation only has any effect on points (\(w = 1\)): vectors (\(w = 0\)) remain unaffected.
Example
|
Translating \(P(3, 5)\) by \(\vec v(2,-4)\):
\[\begin{bmatrix}
1 & 0 & 2 \\
0 & 1 & -4 \\
0 & 0 & 1 \\
\end{bmatrix}
\cdot
\begin{bmatrix}
3 \\
5 \\
1 \\
\end{bmatrix}
=
\begin{bmatrix}
4 \\
-1 \\
1 \\
\end{bmatrix}\]
|
Example
|
Translating \(\vec n(0, 1)\) by \(\vec v(2,-4)\):
\[\begin{bmatrix}
1 & 0 & 2 \\
0 & 1 & -4 \\
0 & 0 & 1 \\
\end{bmatrix}
\cdot
\begin{bmatrix}
0 \\
1 \\
0 \\
\end{bmatrix}
=
\begin{bmatrix}
0 \\
1 \\
0 \\
\end{bmatrix}\]
Notice how translating a vector has no effect. |