Microsoft DirectX 8.0 (C++)

Translation

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 Direct3DX
    ret(3, 0) = dx;
    ret(3, 1) = dy;
    ret(3, 2) = dz;
    return ret;
}    // End of Translate

For convenience, the Direct3DX utility library supplies the D3DXMatrixTranslation function.