transformation_matrix function

Transformation matrix, 2D or 3D depending on data and transformation type