private void button5_Click(object sender, EventArgs e)
        {



            // This button tests TorqueBall.OrthonormalizeOrientation




            ClearPictureBox();

            // Setup Orig Vector
            MyVector origVector = new MyVector(9, 0, 0);
            DrawVector(origVector, Color.Silver);

            // Rotate around Z
            MyQuaternion rotationQuat = new MyQuaternion(new MyVector(0, 0, 1), Utility3D.GetDegreesToRadians(30));

            MyVector rotated = rotationQuat.GetRotatedVector(origVector, true);
            DrawVector(rotated, Color.Black);

            MyMatrix3 rotationMatrix = rotationQuat.ToMatrix3FromUnitQuaternion();




            // See if this affects the rotation matrix
            TorqueBall.OrthonormalizeOrientation(rotationMatrix);





            rotationQuat = null;
            rotationQuat = new MyQuaternion();
            rotationQuat.FromRotationMatrix(rotationMatrix);

            rotationMatrix = null;


            // Draw the results
            rotated = rotationQuat.GetRotatedVector(origVector, true);
            DrawVector(rotated, Color.DodgerBlue);
        }
        private void btnRotationMatrix_Click(object sender, EventArgs e)
        {
            ClearPictureBox();

            // Setup Orig Vector
            MyVector origVector = new MyVector(9, 0, 0);
            DrawVector(origVector, Color.Silver);

            // Rotate around Z
            MyQuaternion rotationQuat = new MyQuaternion(new MyVector(0, 0, 1), Utility3D.GetDegreesToRadians(30));

            MyVector rotated = rotationQuat.GetRotatedVector(origVector, true);
            DrawVector(rotated, Color.Black);

            MyMatrix3 rotationMatrix;
            for (int cntr = 1; cntr <= 10000000; cntr++)
            {
                rotationMatrix = rotationQuat.ToMatrix3FromUnitQuaternion();

                rotationQuat = null;
                rotationQuat = new MyQuaternion();
                rotationQuat.FromRotationMatrix(rotationMatrix);

                rotationMatrix = null;
            }


            rotated = rotationQuat.GetRotatedVector(origVector, true);
            DrawVector(rotated, Color.DodgerBlue);

            rotationQuat.W *= -1;
            MyVector rotatedNegated = rotationQuat.GetRotatedVector(origVector, true);
            DrawVector(rotatedNegated, Color.Yellow);
        }