/// <summary> Sets the value of this axis-angle to the rotational component of /// the passed matrix. /// If the specified matrix has no rotational component, the value /// of this AxisAngle4f is set to an angle of 0 about an axis of (0,1,0). /// </summary> /// <param name="m1">the matrix4f /// </param> public void set_Renamed(Matrix4f m1) { Matrix3f m3f = new Matrix3f(); m1.get_Renamed(m3f); x = m3f.m21 - m3f.m12; y = m3f.m02 - m3f.m20; z = m3f.m10 - m3f.m01; double mag = x * x + y * y + z * z; if (mag > EPS) { mag = System.Math.Sqrt(mag); double sin = 0.5 * mag; double cos = 0.5 * (m3f.m00 + m3f.m11 + m3f.m22 - 1.0); //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" angle = (float) System.Math.Atan2(sin, cos); double invMag = 1.0 / mag; //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" x = (float) (x * invMag); //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" y = (float) (y * invMag); //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" z = (float) (z * invMag); } else { x = 0.0f; y = 1.0f; z = 0.0f; angle = 0.0f; } }