public void SetView(EOrthographicView view) { float rot90deg = (float)(Math.PI * 0.5); switch (view) { case EOrthographicView.XY: SetRotationMatrixAsXYPlane(); break; case EOrthographicView.XZ: { float[,] rotMatrix = MathMatrix.CalcHomogeneousRotMatrix(-1 * rot90deg, 0, 0); SetRotationMatrixAsXYPlane(); m_RotationMatrix = m_RotationMatrix.Multiply(rotMatrix); } break; case EOrthographicView.YZ: { float[,] rotMatrix = MathMatrix.CalcHomogeneousRotMatrix(0, -1 * rot90deg, 0); SetRotationMatrixAsXYPlane(); m_RotationMatrix = m_RotationMatrix.Multiply(rotMatrix); } break; case EOrthographicView.Isometric: { // Assume currently is XY plane, rotate to isometric position // Rot X 45 deg float thetaX = -1 * (float)(0.25 * Math.PI); float thetaY = 0f; // Then Rot Z 135 deg float thetaZ = (float)(-135f / 180 * Math.PI); float[,] rotMatrix = MathMatrix.CalcHomogeneousRotMatrix(thetaX, thetaY, thetaZ); float[,] vec = new float[3, 1] { { (float)(1f / Math.Sqrt(3)) }, { (float)(1f / Math.Sqrt(3)) }, { (float)(1f / Math.Sqrt(3)) } }; SetRotationMatrixAsXYPlane(); m_RotationMatrix = m_RotationMatrix.Multiply(rotMatrix); } break; default: // undone break; } }
public void RotateView(float thetaX, float thetaY, float thetaZ) { float[,] rotMatrix = MathMatrix.CalcHomogeneousRotMatrix(thetaX, thetaY, thetaZ); m_RotationMatrix = m_RotationMatrix.Multiply(rotMatrix); }