Commit 8e0894b5 authored by stoutjesdijk's avatar stoutjesdijk 🎧
Browse files

function prototype for Euler2Quat

parent e96871af
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@

*******************************************************************************************************/

#include "common_api_types.h"
#include <stdint.h>
#include "options.h"
#include "ivas_prot.h"
@@ -456,19 +457,26 @@ ivas_error ivas_orient_trk_Process(
    float alpha = pOTR->alpha;
    float ang;
    ivas_error result;
    IVAS_QUATERNION quat;

    if ( pOTR == NULL || pTrkRot == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    quat.w = 0.0f;
    quat.x = 0.0f;
    quat.y = 0.0f;
    quat.z = 0.0f;
    /* check for Euler angle signaling */
    //if ( pOTR->refRot.w == -3.0f )
    //{
    //    // convert to quaternion
    //    // port https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles

    //}
    if ( pOTR->refRot.w == -3.0f )
    {
        Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &quat);
    }
    else
    {
        quat = pOTR->refRot;
    }

    result = IVAS_ERR_OK;

@@ -486,7 +494,7 @@ ivas_error ivas_orient_trk_Process(
            pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate );

            /* Compute relative orientation = (absolute orientation) - (reference orientation) */
            QuaternionInverse( pOTR->refRot, pTrkRot );
            QuaternionInverse( quat, pTrkRot );
            QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot );
            break;

+11 −0
Original line number Diff line number Diff line
@@ -796,12 +796,23 @@ void ivas_headTrack_close(
);
#endif

#ifndef FIX_I109_ORIENTATION_TRACKING
void Quat2Euler(
    const IVAS_QUATERNION quat,                                 /* i  : quaternion describing the rotation              */
    float *yaw,                                                 /* o  : yaw                                             */
    float *pitch,                                               /* o  : pitch                                           */
    float *roll                                                 /* o  : roll                                            */
);
#endif

#ifdef FIX_I109_ORIENTATION_TRACKING
void Euler2Quat(
    const float yaw,                                                 /* i  : yaw                                             */
    const float pitch,                                               /* i  : pitch                                           */
    const float roll,                                                /* i  : roll                                            */
    IVAS_QUATERNION *quat                                  /* o  : quaternion describing the rotation              */
);
#endif

void QuatToRotMat(
    const IVAS_QUATERNION quat,                                 /* i  : quaternion describing the rotation              */
+24 −0
Original line number Diff line number Diff line
@@ -213,6 +213,30 @@ void Quat2Euler(
}
#endif

#ifdef FIX_I109_ORIENTATION_TRACKING
/*-------------------------------------------------------------------------
 * Euler2Quat()
 *
 * Quaternion handling: calculate corresponding Euler angles
 *------------------------------------------------------------------------*/

void Euler2Quat(
    const float yaw,                 /* i  : yaw                                 */
    const float pitch,               /* i  : pitch                               */
    const float roll,                /* i  : roll                                */
    IVAS_QUATERNION *quat  /* o  : quaternion describing the rotation  */
)
{
    // @TODO implementation here
    quat->w = -3.0f;
    quat->x = yaw;
    quat->y = pitch;
    quat->z = roll;

    return;
}
#endif


/*-------------------------------------------------------------------------
 * rotateAziEle()