/// <summary> /// Returns the integer associated with the dominant axis about which the rotation moves. /// Chooses Z in the two degenerate cases. /// x = 0 /// y = 1 /// z = 2 /// Doesn't work. /// </summary> /// <param name="M">The affine matrix with some rotational componenet to analyse.</param> /// <returns></returns> public static int getDominantRotationAxis(OpenTK.Matrix4 M) { OpenTK.Quaternion R = M.ExtractRotation(); if (System.Math.Abs(R.X) > System.Math.Abs(R.Y) && System.Math.Abs(R.X) > System.Math.Abs(R.Z)) { return(0); } else if (System.Math.Abs(R.Y) > System.Math.Abs(R.Z)) { return(1); } return(2); }