Commit 1b7fe882 authored by stoutjesdijk's avatar stoutjesdijk 🎧
Browse files

added writing function

parent 5ee66fa9
Loading
Loading
Loading
Loading
+1 −26
Original line number Diff line number Diff line
@@ -96,32 +96,7 @@ ivas_error HeadRotationFileWriting(
    IVAS_QUATERNION *pQuaternion      /* i  : head-tracking data             */
)
{
    float w, x, y, z;
    float posx, posy, posz;
    int32_t read_values;

    posx = 0.0f;
    posy = 0.0f;
    posz = 0.0f;

    read_values = fscanf( headRotWriter->trajFile, "%f,%f,%f,%f,%f,%f,%f", &w, &x, &y, &z, &posx, &posy, &posz );
    if ( ( read_values != 4 ) && ( read_values != 7 ) ) /* Allow either orientation (4) or orientation+position (4+3) */
    {
        if ( feof( headRotWriter->trajFile ) )
        {
            rewind( headRotWriter->trajFile );
            headRotWriter->fileRewind = true;
            return HeadRotationFileWriting( headRotWriter, pQuaternion );
        }
        return IVAS_ERR_FAILED_FILE_PARSE;
    }

    ( headRotWriter->frameCounter )++;

    pQuaternion->w = w;
    pQuaternion->x = x;
    pQuaternion->y = y;
    pQuaternion->z = z;
    fprintf(headRotWriter->trajFile, "%f %f %f %f\r\n", pQuaternion->w, pQuaternion->x, pQuaternion->y, pQuaternion->z);

    return IVAS_ERR_OK;
}