| Microsoft DirectX 8.1 (C++) | 
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.
You can create a translation matrix by hand in Microsoft® Visual Basic®. The following example shows the source code for a function that creates a matrix to translate vertices.
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').
