public static Matrix4 TransformationMatrix(double dx, double dy, double dz, double ez, double ey, double ex, bool useDCMTranspose) { Matrix4 T = new Matrix4(); Matrix3 dcm = Matrix3.DCM(ez, ey, ex); //Assign the full transformation matrix for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { //Test if using the dcm transpose if (useDCMTranspose) { T[i, j] = dcm[j, i]; } else { T[i, j] = dcm[i, j]; } } } //Assign the translation T[0, 3] = dx; T[1, 3] = dy; T[2, 3] = dz; T[3, 3] = 1.0; return(T); }