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
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
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
Now that we’re using perspective geometry to represent entities, let’s imagine a point
Let
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
The general 3D translation matrix is then denoted as