none
Face rotation - Euler angles strange behaviour near zero degrees RRS feed

  • Question

  • Hi,

    I'm trying to move something according to the head rotation of the user (yaw, pitch). So I'm getting the Quaternion values of the FaceRotationQuaternion Property of faceFramResult and use the ExtractFaceRotationInDegrees function of the Face Basic Sample to convert them to degrees.

    It works fine, except near the center 0,0 then the yaw and pitch degrees often jump to straight 0

    I'm not so into Quaternions and would be thankful for an advice.

    Thanks,

    Patrick

    double x = rotQuaternion.X;
    double y = rotQuaternion.Y;
    double z = rotQuaternion.Z;
    double w = rotQuaternion.W;

    pitchD = -Math.Atan2(2 * ((y * z) + (w * x)), (w * w) - (x * x) - (y * y) + (z * z)) / Math.PI * 180.0; yawD = -Math.Asin(2 * ((w * y) - (x * z))) / Math.PI * 180.0; rollD = -Math.Atan2(2 * ((x * y) + (w * z)), (w * w) + (x * x) - (y * y) - (z * z)) / Math.PI * 180.0;



    • Edited by M Patrick Tuesday, December 29, 2015 5:50 PM update title
    Tuesday, December 29, 2015 5:47 PM