This article is part 4 in the series about transformation matrices:
- Part 1: Coordinate systems and transformations between them
- Part 2: Scaling objects with a transformation matrix
- Part 3: Shearing objects with a transformation matrix
- Part 4: Translating objects with a transformation matrix (this article)
- Part 5: Combining Matrix Transformations
2D translation
A translation is an affine transformation which is a linear transformation followed by some displacement
Even though we can’t express 2D translation using a 2x2 matrix, we can express such a transformation as a shearing transformation in 3D projective geometry, to do so we have to imagine that the 2D Euclidean world exists as the plane $w = 1$ in a 3D space, under this geometry any point has the form $\begin{bmatrix} x & y & 1 \end{bmatrix}$
In Euclidean geometry a vector expressed as a linear combination of the standard basis has the form
In Projective geometry a vector which exists in the plane $w = 1$ has the form
This basis can be represented using the following transformation matrix
The translation transform then can be seen in Projective geometry as a simple shearing of the space by the coordinate $w$, using the shearing transform $\mathbf{H_{xy}}(\Delta{x}, \Delta{y})$ to transform a point $v$
Now that we’re using perspective geometry to represent entities, let’s imagine a point $p = \begin{bmatrix} x & y & 0 \end{bmatrix}$ (a point that lies in the plane $w = 0$), whenever this point is transformed by a transformation matrix we can notice that the translation components of the matrix are cancelled because of $w = 0$, we can take advantage of this fact and represent vectors with this notation.
Let $v_{\infty}$ be a point located in the plane $w = 0$, applying the shearing operation $\mathbf{H_{xy}}(s, t)$ results in
It’s important to note that this matrix multiplication is still a linear transformation and that this trick of translating 2D points is actually a shearing of the 3D projective plane
3D translation
Similarly to 2D a 3D translation can be represented as a shearing of the 4D projective hyperplane which has the form
When a 4D vector existing on the hyperplane $w = 1$ is transformed with this matrix the result is
The general 3D translation matrix is then denoted as
References
- Dunn, F. and Parberry, I. (2002). 3D math primer for graphics and game development. Plano, Tex.: Wordware Pub.