public void Identity() { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { this.m_matrix[i, j] = 0.0f; } } this.m_matrix[0, 0] = 1.0f; this.m_matrix[1, 1] = 1.0f; this.m_matrix[2, 2] = 1.0f; this.m_matrix[3, 3] = 1.0f; }
/// <summary> /// get a matrix used to rotate object specific angle on Z direction /// </summary> /// <param name="angle">rotate angle</param> /// <returns>matrix which rotate object specific angle on Z direction</returns> public static Matrix4 RotateZ(double angle) { Matrix4 rotateX = new Matrix4(); rotateX.Type = MatrixType.Rotation; rotateX.Identity(); double sin = (double)Math.Sin(angle); double cos = (double)Math.Cos(angle); rotateX.Matrix[1, 1] = cos; rotateX.Matrix[1, 2] = sin; rotateX.Matrix[2, 1] = -sin; rotateX.Matrix[2, 2] = cos; return(rotateX); }