Export (0) Print
Expand All

Translation and Scaling


The following transformation translates the point (x, y, z) to a new point (x', y', z').

Translate 18

You can manually create a translation matrix in managed code. The following C# code example shows the source code for a function that creates a matrix to translate vertices.

private Matrix TranslateMatrix(float dx, float dy, float dz)
   Matrix ret;

   ret = Matrix.Identity;

   ret.M41 = dx;
   ret.M42 = dy;
   ret.M43 = dz;

   return ret;

For convenience, managed the Microsoft Direct3D supplies the Translation method.


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').

Matrix scale

© 2015 Microsoft