Translate With Dots
Earlier we saw that to translate a vector \(\mathbf{p}\) is to add it component-wise with a vector of offsets. Translation has this vector notation:
Those right-hand sides don't look like dot products at all. Nevertheless, as with scaling and rotation, we want to rewrite the equations above to use dot products. They will have this form:
Let's again expand out these equations to see how the dot products might be constructed:
Neither \(p_y\) nor \(p_z\) are involved in the scalar definition of \(p'_x\), so we zero out their coefficients in \(\mathbf{a}\). The coefficient for \(p_x\) is an implicit 1. That leads us to this possible definition:
But that can't be right. There's no mention of \(\textrm{offset}_x\) anywhere. Perhaps translation cannot be recast as a dot product? Fear not. To make translation fit in the dot product machinery, we will bend the rules. From out of the blue, we will add 1 as a fourth component of \(\mathbf{p}\):
This special fourth component is the homogeneous coordinate that we introduced in chapter 1. There we used it to distinguish between points and vectors. Now we use it for the purpose of expressing translation as a dot product.
We must pair the 1 of the second vector with \(\textrm{offset}_x\) in the first vector to effect the translation. Thus \(p'_x\) is this dot product:
Components \(p_y\) and \(p_z\) are expressed similarly. Altogether, translation has this dot product form:
With help from the homogeneous coordinate, we've recast translation as a series of dot products. The next step is to get the graphics card to evaluate all of the dot products in parallel.