Axiom.Math.Quaternion.FromEulerAngles C# (CSharp) Method

FromEulerAngles() public static method

Combines the euler angles in the order yaw, pitch, roll to create a rotation quaternion
public static FromEulerAngles ( Real pitch, Real yaw, Real roll ) : Quaternion
pitch Real
yaw Real
roll Real
return Quaternion
		public static Quaternion FromEulerAngles( Real pitch, Real yaw, Real roll )
		{
			return Quaternion.FromAngleAxis( yaw, Vector3.UnitY )
				* Quaternion.FromAngleAxis( pitch, Vector3.UnitX )
				* Quaternion.FromAngleAxis( roll, Vector3.UnitZ );

			/*TODO: Debug
			//Equation from http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm
			//heading
			
			Real c1 = (Real)Math.Cos(yaw/2);
			Real s1 = (Real)Math.Sin(yaw/2);
			//attitude
			Real c2 = (Real)Math.Cos(roll/2);
			Real s2 = (Real)Math.Sin(roll/2);
			//bank
			Real c3 = (Real)Math.Cos(pitch/2);
			Real s3 = (Real)Math.Sin(pitch/2);
			Real c1c2 = c1*c2;
			Real s1s2 = s1*s2;

			Real w =c1c2*c3 - s1s2*s3;
			Real x =c1c2*s3 + s1s2*c3;
			Real y =s1*c2*c3 + c1*s2*s3;
			Real z =c1*s2*c3 - s1*c2*s3;
			return new Quaternion(w,x,y,z);*/
		}