Commit 17e2c2ad authored by stoutjesdijk's avatar stoutjesdijk 🎧
Browse files

implementation of Euler2Quat

parent 8e0894b5
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -227,11 +227,17 @@ void Euler2Quat(
    IVAS_QUATERNION *quat  /* o  : quaternion describing the rotation  */
)
{
    // @TODO implementation here
    quat->w = -3.0f;
    quat->x = yaw;
    quat->y = pitch;
    quat->z = roll;
    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 );

    quat->w = cr * cp * cy + sr * sp * sy;
    quat->x = sr * cp * cy - cr * sp * sy;
    quat->y = cr * sp * cy + sr * cp * sy;
    quat->z = cr * cp * sy - sr * sp * cy;

    return;
}