Added Quat_FromPitchYawRoll() helper function.

Quickly converts pitch, yaw, and roll rotations to the Quaternion equivalent orientation.
This commit is contained in:
Thompson Lee 2016-08-17 16:41:02 -04:00
parent ae0ce14c9d
commit 0452029690

View File

@ -668,4 +668,16 @@ static inline C3D_FVec FVec3_CrossQuat(C3D_FVec v, C3D_FQuat q)
// v×q = q^-1×v
return Quat_CrossFVec3(Quat_Inverse(q), v);
}
/**
* @brief Converting Pitch, Yaw, and Roll to Quaternion equivalent
* @param[in] pitch The pitch angle in radians.
* @param[in] yaw The yaw angle in radians.
* @param[in] roll The roll angle in radians.
* @return C3D_FQuat The Quaternion equivalent with the pitch, yaw, and roll orientations applied.
*/
static inline C3D_FQuat Quat_FromPitchYawRoll(float pitch, float yaw, float roll)
{
return Quat_RotateZ(Quat_RotateY(Quat_RotateX(Quat_Identity(), pitch, false), yaw, false), roll, false);
}
///@}