/// <summary> /// Returns the rotationaxis of a orthogonal matrix and the rotation angle. /// </summary> /// <param name="Angle">Angle of the rotation of the matrix</param> /// <returns></returns> public LineType GetRotationAxis(ref double Angle) { Matrix M = this; xyz P1 = new xyz(1, 0, 0); xyz P2 = M * P1; xyz P3 = M * P2; LineType Result; if (P2.Equals(P1)) { P1 = new xyz(0, 1, 0); P2 = M * P1; P3 = M * P2; if (P2.Equals(P1)) { Result = new LineType(P1, new xyz(1, -1, 0)); Angle = Utils.Angle(new xyz(0, 0, 1), M * (new xyz(0, 0, 1)), new xyz(1, 1, 0)); if (System.Math.Abs(Angle) < 0.000001) { Result = new LineType(xyz.Null, new xyz(0, 0, 1)); } return(Result); } } Plane Plane1 = new Plane(((P1 + P2) * 0.5), P2 - P1); Plane Plane2 = new Plane(((P2 + P3) * 0.5), P3 - P2); return(Plane1.Cross(Plane2)); }