Commit a39e0f1f authored by Marek Szczerba's avatar Marek Szczerba
Browse files

QuatToRotMat update correction (wrong input mode)

parent c9e9279b
Loading
Loading
Loading
Loading
Loading
+9 −17
Original line number Diff line number Diff line
@@ -122,25 +122,17 @@ void QuatToRotMat(
    float s1, s2, s3, c1, c2, c3;

#ifdef FIX_I109_ORIENTATION_TRACKING
    c1 = cosf( quat.z / _180_OVER_PI );
    c2 = cosf( quat.y / _180_OVER_PI );
    c3 = cosf( quat.x / _180_OVER_PI );

    s1 = sinf( quat.z / _180_OVER_PI );
    s2 = sinf( -quat.y / _180_OVER_PI );
    s3 = sinf( quat.x / _180_OVER_PI );

    Rmat[0][0] = c2 * c3;
    Rmat[0][1] = -c2 * s3;
    Rmat[0][2] = s2;
    Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z;
    Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z );
    Rmat[0][2] = 2.0f * ( quat.x * quat.z + quat.w * quat.y );

    Rmat[1][0] = c1 * s3 + c3 * s1 * s2;
    Rmat[1][1] = c1 * c3 - s1 * s2 * s3;
    Rmat[1][2] = -c2 * s1;
    Rmat[1][0] = 2.0f * ( quat.x * quat.y + quat.w * quat.z );
    Rmat[1][1] = quat.w * quat.w - quat.x * quat.x + quat.y * quat.y - quat.z * quat.z;
    Rmat[1][2] = 2.0f * ( quat.y * quat.z - quat.w * quat.x );

    Rmat[2][0] = s1 * s3 - c1 * c3 * s2;
    Rmat[2][1] = c3 * s1 + c1 * s2 * s3;
    Rmat[2][2] = c1 * c2;
    Rmat[2][0] = 2.0f * ( quat.x * quat.z - quat.w * quat.y );
    Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x );
    Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z;
#else

#ifdef DEBUGGING