/// <summary> /// Rotate the model with the given angles /// </summary> /// <param name="objData">Data parsed from the obj file</param> /// <param name="aX">Rotation angle on the X axis</param> /// <param name="aY">Rotation angle on the Y axis</param> /// <param name="aZ">Rotation angle on the Z axis</param> public static void RotateModel(ObjData objData, double aX, double aY, double aZ) { Matrix3D matrixX = Matrix3D.GetXRotationMatrix(AngleUtils.DegreeToRadian(aX)); Matrix3D matrixY = Matrix3D.GetXRotationMatrix(AngleUtils.DegreeToRadian(aY)); Matrix3D matrixZ = Matrix3D.GetXRotationMatrix(AngleUtils.DegreeToRadian(aZ)); foreach (ObjectObj objectObj in objData.ObjectsList) { foreach (Point p in objectObj.VerticesList) { p.MultiplicationMatrix(matrixX); p.MultiplicationMatrix(matrixY); p.MultiplicationMatrix(matrixZ); } foreach (Vector v in objectObj.NormalsList) { v.MultiplicationMatrix(matrixX); v.MultiplicationMatrix(matrixY); v.MultiplicationMatrix(matrixZ); } } }