/// <summary>
 /// Computes the axis of rotation and angle in radian of the quaternion q.
 /// </summary>
 /// <param name="q"></param>
 /// <param name="axis"></param>
 /// <param name="angle"></param>
 public static void GetAxisAngle(Quaternion q, out Vector3 axis, float angle)
 {
     float scale = q.Length();
     axis.X = q.X / scale;
     axis.Y = q.Y / scale;
     axis.Z = q.Z / scale;
     angle = (float)Math.Acos(q.W) * 2;
 }
Exemple #2
0
 public void Length()
 {
     Quaternion q1 = new Quaternion(1, 2, 3, 4);
     Compare(5.477226f,q1.Length());
 }