Microsoft DirectX 8.1 (Visual Basic) |
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 Microsoft® Visual Basic®. The following example shows the source code for a function that creates a matrix to translate vertices.
Sub TranslateMatrix(m As D3DMATRIX, v As D3DVECTOR) D3DXMatrixIdentity m ' Implemented by Direct3DX. m.m41 = v.x m.m42 = v.y m.m43 = v.z End Sub
For convenience, the Direct3DX 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').