| ?/TD> |
| Microsoft DirectX 9.0 |
The following transformation translates the point (x, y, z) to a new point (x', y', z').

You can create a translation matrix by hand in C++. The following example shows the source code for a function that creates a matrix to translate vertices.
D3DXMATRIX Translate(const float dx, const float dy, const float dz) {
D3DXMATRIX ret;
D3DXMatrixIdentity(&ret); // Implemented by Direct3D extensions (D3DX)
ret(3, 0) = dx;
ret(3, 1) = dy;
ret(3, 2) = dz;
return ret;
} // End of Translate
For convenience, the Direct3D extensions (D3DX) utility library supplies the D3DXMatrixTranslation function.
The following transformation scales the point (x, y, z) by arbitrary values in the x-, y-, and z-directions to a new point (x', y', z').
