2D Computer Graphics - Translation

Translation

Since a translation is an affine transformation but not a linear transformation, homogeneous coordinates are normally used to represent the translation operator by a matrix and thus to make it linear. Thus we write the 3-dimensional vector w = (wx, wy, wz) using 4 homogeneous coordinates as w = (wx, wy, wz, 1).

To translate an object by a vector v, each homogeneous vector p (written in homogeneous coordinates) would need to be multiplied by this translation matrix:

 T_{\mathbf{v}} =
\begin{bmatrix}
1 & 0 & 0 & v_x \\
0 & 1 & 0 & v_y \\
0 & 0 & 1 & v_z \\
0 & 0 & 0 & 1
\end{bmatrix}

As shown below, the multiplication will give the expected result:

 T_{\mathbf{v}} \mathbf{p} =
\begin{bmatrix}
1 & 0 & 0 & v_x \\
0 & 1 & 0 & v_y\\
0 & 0 & 1 & v_z\\
0 & 0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
p_x \\ p_y \\ p_z \\ 1
\end{bmatrix}
=
\begin{bmatrix}
p_x + v_x \\ p_y + v_y \\ p_z + v_z \\ 1
\end{bmatrix}
= \mathbf{p} + \mathbf{v}

The inverse of a translation matrix can be obtained by reversing the direction of the vector:

Similarly, the product of translation matrices is given by adding the vectors:

Because addition of vectors is commutative, multiplication of translation matrices is therefore also commutative (unlike multiplication of arbitrary matrices).

Read more about this topic:  2D Computer Graphics

Famous quotes containing the word translation:

    To translate, one must have a style of his own, for otherwise the translation will have no rhythm or nuance, which come from the process of artistically thinking through and molding the sentences; they cannot be reconstituted by piecemeal imitation. The problem of translation is to retreat to a simpler tenor of one’s own style and creatively adjust this to one’s author.
    Paul Goodman (1911–1972)

    Well meant are the wounds a friend inflicts, but profuse are the kisses of an enemy.
    Bible: Hebrew, Proverbs 27:6.

    KJ translation reads: Faithful are the wounds of a friend.

    ...it is better to marry than to be aflame with passion.
    Bible: New Testament, 1 Corinthians 7:9.

    King James translation reads, “It is better to marry than to burn.”