Loading lib_rend/ivas_orient_trk.c +39 −13 Original line number Diff line number Diff line Loading @@ -457,25 +457,40 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; IVAS_QUATERNION quat; IVAS_QUATERNION refQuat, trkQuat; IVAS_QUATERNION trkEuler; 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; refQuat.w = 0.0f; refQuat.x = 0.0f; refQuat.y = 0.0f; refQuat.z = 0.0f; /* check for Euler angle signaling */ if ( pOTR->refRot.w == -3.0f ) { Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &quat); Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &refQuat); } else { quat = pOTR->refRot; refQuat = pOTR->refRot; } trkQuat.w = 0.0f; trkQuat.x = 0.0f; trkQuat.y = 0.0f; trkQuat.z = 0.0f; /* check for Euler angle signaling */ if ( pTrkRot->w == -3.0f ) { Euler2Quat(pTrkRot->x, pTrkRot->y, pTrkRot->z, &trkQuat); } else { trkQuat = *pTrkRot; } result = IVAS_ERR_OK; Loading @@ -483,7 +498,7 @@ ivas_error ivas_orient_trk_Process( switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: *pTrkRot = *pAbsRot; trkQuat = *pAbsRot; break; case OTR_TRACKING_REF_ORIENT: Loading @@ -494,8 +509,8 @@ ivas_error ivas_orient_trk_Process( pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( quat, pTrkRot ); QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); QuaternionInverse( refQuat, &trkQuat ); QuaternionProduct( trkQuat, *pAbsRot, &trkQuat ); break; case OTR_TRACKING_AVG_ORIENT: Loading @@ -503,8 +518,8 @@ ivas_error ivas_orient_trk_Process( QuaternionSlerp( pOTR->absAvgRot, *pAbsRot, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ QuaternionInverse( pOTR->absAvgRot, pTrkRot ); QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); QuaternionInverse( pOTR->absAvgRot, &trkQuat ); QuaternionProduct( trkQuat, *pAbsRot, &trkQuat ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) Loading Loading @@ -542,7 +557,18 @@ ivas_error ivas_orient_trk_Process( if ( result == IVAS_ERR_OK ) { pOTR->trkRot = *pTrkRot; pOTR->trkRot = trkQuat; if ( pTrkRot->w == -3.0f ) { Quat2Euler(trkQuat, &trkEuler.x, &trkEuler.y, &trkEuler.z); trkEuler.w = -3.0f; *pTrkRot = trkEuler; } else { *pTrkRot = trkQuat; } } return result; Loading lib_rend/ivas_prot_rend.h +0 −2 Original line number Diff line number Diff line Loading @@ -796,14 +796,12 @@ 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( Loading lib_rend/ivas_rotation.c +14 −10 Original line number Diff line number Diff line Loading @@ -176,7 +176,6 @@ void QuatToRotMat( return; } #ifndef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- * Quat2Euler() * Loading Loading @@ -204,14 +203,19 @@ void Quat2Euler( * pitch: rotate scene in the median plane, increase elevation with positive values * roll: rotate scene from the right ear to the top */ #ifdef FIX_I109_ORIENTATION_TRACKING *yaw = quat.x; *pitch = quat.y; *roll = quat.z; #else *yaw = quat.z; *pitch = quat.y; *roll = quat.x; #endif } return; } #endif #ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- Loading @@ -227,12 +231,12 @@ void Euler2Quat( IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ) { float cr = cos( roll * 0.5f ); float sr = sin( roll * 0.5f ); float cp = cos( pitch * 0.5f ); float sp = sin( pitch * 0.5f ); float cy = cos( yaw * 0.5f ); float sy = sin( yaw * 0.5f ); float cr = cosf( roll * 0.5f ); float sr = sinf( roll * 0.5f ); float cp = cosf( pitch * 0.5f ); float sp = sinf( pitch * 0.5f ); float cy = cosf( yaw * 0.5f ); float sy = sinf( yaw * 0.5f ); quat->w = cr * cp * cy + sr * sp * sy; quat->x = sr * cp * cy - cr * sp * sy; Loading Loading
lib_rend/ivas_orient_trk.c +39 −13 Original line number Diff line number Diff line Loading @@ -457,25 +457,40 @@ ivas_error ivas_orient_trk_Process( float alpha = pOTR->alpha; float ang; ivas_error result; IVAS_QUATERNION quat; IVAS_QUATERNION refQuat, trkQuat; IVAS_QUATERNION trkEuler; 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; refQuat.w = 0.0f; refQuat.x = 0.0f; refQuat.y = 0.0f; refQuat.z = 0.0f; /* check for Euler angle signaling */ if ( pOTR->refRot.w == -3.0f ) { Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &quat); Euler2Quat(pOTR->refRot.x, pOTR->refRot.y, pOTR->refRot.z, &refQuat); } else { quat = pOTR->refRot; refQuat = pOTR->refRot; } trkQuat.w = 0.0f; trkQuat.x = 0.0f; trkQuat.y = 0.0f; trkQuat.z = 0.0f; /* check for Euler angle signaling */ if ( pTrkRot->w == -3.0f ) { Euler2Quat(pTrkRot->x, pTrkRot->y, pTrkRot->z, &trkQuat); } else { trkQuat = *pTrkRot; } result = IVAS_ERR_OK; Loading @@ -483,7 +498,7 @@ ivas_error ivas_orient_trk_Process( switch ( pOTR->trackingType ) { case OTR_TRACKING_NONE: *pTrkRot = *pAbsRot; trkQuat = *pAbsRot; break; case OTR_TRACKING_REF_ORIENT: Loading @@ -494,8 +509,8 @@ ivas_error ivas_orient_trk_Process( pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse( quat, pTrkRot ); QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); QuaternionInverse( refQuat, &trkQuat ); QuaternionProduct( trkQuat, *pAbsRot, &trkQuat ); break; case OTR_TRACKING_AVG_ORIENT: Loading @@ -503,8 +518,8 @@ ivas_error ivas_orient_trk_Process( QuaternionSlerp( pOTR->absAvgRot, *pAbsRot, alpha, &pOTR->absAvgRot ); /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ QuaternionInverse( pOTR->absAvgRot, pTrkRot ); QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot ); QuaternionInverse( pOTR->absAvgRot, &trkQuat ); QuaternionProduct( trkQuat, *pAbsRot, &trkQuat ); /* Adapt LPF constant based on orientation excursion relative to current mean: - low cutoff (slow adaptation) for small excursions (around center) Loading Loading @@ -542,7 +557,18 @@ ivas_error ivas_orient_trk_Process( if ( result == IVAS_ERR_OK ) { pOTR->trkRot = *pTrkRot; pOTR->trkRot = trkQuat; if ( pTrkRot->w == -3.0f ) { Quat2Euler(trkQuat, &trkEuler.x, &trkEuler.y, &trkEuler.z); trkEuler.w = -3.0f; *pTrkRot = trkEuler; } else { *pTrkRot = trkQuat; } } return result; Loading
lib_rend/ivas_prot_rend.h +0 −2 Original line number Diff line number Diff line Loading @@ -796,14 +796,12 @@ 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( Loading
lib_rend/ivas_rotation.c +14 −10 Original line number Diff line number Diff line Loading @@ -176,7 +176,6 @@ void QuatToRotMat( return; } #ifndef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- * Quat2Euler() * Loading Loading @@ -204,14 +203,19 @@ void Quat2Euler( * pitch: rotate scene in the median plane, increase elevation with positive values * roll: rotate scene from the right ear to the top */ #ifdef FIX_I109_ORIENTATION_TRACKING *yaw = quat.x; *pitch = quat.y; *roll = quat.z; #else *yaw = quat.z; *pitch = quat.y; *roll = quat.x; #endif } return; } #endif #ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------- Loading @@ -227,12 +231,12 @@ void Euler2Quat( IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ) { float cr = cos( roll * 0.5f ); float sr = sin( roll * 0.5f ); float cp = cos( pitch * 0.5f ); float sp = sin( pitch * 0.5f ); float cy = cos( yaw * 0.5f ); float sy = sin( yaw * 0.5f ); float cr = cosf( roll * 0.5f ); float sr = sinf( roll * 0.5f ); float cp = cosf( pitch * 0.5f ); float sp = sinf( pitch * 0.5f ); float cy = cosf( yaw * 0.5f ); float sy = sinf( yaw * 0.5f ); quat->w = cr * cp * cy + sr * sp * sy; quat->x = sr * cp * cy - cr * sp * sy; Loading