public static Matrix4 Rotate(double cosx, double sinx, double cosy, double siny, double cosz, double sinz) { var xRotate = new Matrix4( 1, 0, 0, 0, 0, cosx, -sinx, 0, 0, sinx, cosx, 0, 0, 0, 0, 1 ); var yRotate = new Matrix4( cosy, 0, siny, 0, 0, 1, 0, 0, -siny, 0, cosy, 0, 0, 0, 0, 1); var zRotate = new Matrix4( cosz, -sinz, 0, 0, sinz, cosz, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); xRotate.Multiply(yRotate); xRotate.Multiply(zRotate); return(xRotate); }
// apply addition values to Matrix using multiply // addition to the "this" matrix // "this matrix" = addtion matrix + "this" matrix public void Add(double dX, double dY, double dZ) { var addMatrix = new Matrix4(dX, dY, dZ); addMatrix.Multiply(this); A1 = addMatrix.A1; A2 = addMatrix.A2; A3 = addMatrix.A3; A4 = addMatrix.A4; B1 = addMatrix.B1; B2 = addMatrix.B2; B3 = addMatrix.B3; B4 = addMatrix.B4; C1 = addMatrix.C1; C2 = addMatrix.C2; C3 = addMatrix.C3; C4 = addMatrix.C4; D1 = addMatrix.D1; D2 = addMatrix.D2; D3 = addMatrix.D3; D4 = addMatrix.D4; }
public static Matrix4 Rotate(double cosx, double sinx, double cosy, double siny, double cosz, double sinz) { var xRotate = new Matrix4( 1, 0, 0, 0, 0, cosx, -sinx, 0, 0, sinx, cosx, 0, 0, 0, 0, 1 ); var yRotate = new Matrix4( cosy, 0, siny, 0, 0, 1, 0, 0, -siny, 0, cosy, 0, 0, 0, 0, 1); var zRotate = new Matrix4( cosz, -sinz, 0, 0, sinz, cosz, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); xRotate.Multiply(yRotate); xRotate.Multiply(zRotate); return xRotate; }