mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
made struct versions of euler to quat. Also fixed up documentation in euler to quat struct.
This commit is contained in:
@@ -460,8 +460,8 @@ glm_euler_by_order(vec3 angles, glm_euler_seq ord, mat4 dest) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in x y z order (roll pitch yaw)
|
* rotations in x y z order (roll pitch yaw)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -477,8 +477,8 @@ glm_euler_xyz_quat(vec3 angles, versor dest) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in x z y order (roll yaw pitch)
|
* rotations in x z y order (roll yaw pitch)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -494,8 +494,8 @@ glm_euler_xzy_quat(vec3 angles, versor dest) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in y x z order (pitch roll yaw)
|
* rotations in y x z order (pitch roll yaw)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -511,8 +511,8 @@ glm_euler_yxz_quat(vec3 angles, versor dest) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in y z x order (pitch yaw roll)
|
* rotations in y z x order (pitch yaw roll)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -528,8 +528,8 @@ glm_euler_yzx_quat(vec3 angles, versor dest) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in z x y order (yaw roll pitch)
|
* rotations in z x y order (yaw roll pitch)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -545,8 +545,8 @@ glm_euler_zxy_quat(vec3 angles, versor dest) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in z y x order (yaw pitch roll)
|
* rotations in z y x order (yaw pitch roll)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ glms_euler_by_order(vec3s angles, glm_euler_seq ord) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in x y z order (roll pitch yaw)
|
* rotations in x y z order (roll pitch yaw)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
versors
|
versors
|
||||||
@@ -174,8 +174,8 @@ glms_euler_xyz_quat(vec3s angles) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in x z y order (roll yaw pitch)
|
* rotations in x z y order (roll yaw pitch)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
versors
|
versors
|
||||||
@@ -189,8 +189,8 @@ glms_euler_xzy_quat(vec3s angles) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in y x z order (pitch roll yaw)
|
* rotations in y x z order (pitch roll yaw)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
versors
|
versors
|
||||||
@@ -204,8 +204,8 @@ glms_euler_yxz_quat(vec3s angles) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in y z x order (pitch yaw roll)
|
* rotations in y z x order (pitch yaw roll)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
versors
|
versors
|
||||||
@@ -219,8 +219,8 @@ glms_euler_yzx_quat(vec3s angles) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in z x y order (yaw roll pitch)
|
* rotations in z x y order (yaw roll pitch)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
versors
|
versors
|
||||||
@@ -234,8 +234,8 @@ glms_euler_zxy_quat(vec3s angles) {
|
|||||||
* @brief creates NEW quaternion using rotation angles and does
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
* rotations in z y x order (yaw pitch roll)
|
* rotations in z y x order (yaw pitch roll)
|
||||||
*
|
*
|
||||||
* @param[out] q quaternion
|
* @param[in] angles angles x y z (radians)
|
||||||
* @param[in] angle angles x y z (radians)
|
* @param[out] dest quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
versors
|
versors
|
||||||
|
|||||||
115
include/cglm/struct/handed/euler_to_quat_lh.h
Normal file
115
include/cglm/struct/handed/euler_to_quat_lh.h
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c), Recep Aslantas.
|
||||||
|
*
|
||||||
|
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||||
|
* Full license can be found in the LICENSE file
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Functions:
|
||||||
|
CGLM_INLINE void glms_euler_xyz_quat_lh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_xzy_quat_lh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_yxz_quat_lh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_yzx_quat_lh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_zxy_quat_lh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_zyx_quat_lh(vec3 angles, versor dest);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cglms_euler_to_quat_lh_h
|
||||||
|
#define cglms_euler_to_quat_lh_h
|
||||||
|
|
||||||
|
#include "../common.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in x y z order in left hand (roll pitch yaw)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_xyz_quat_lh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_xyz_quat_lh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in x z y order in left hand (roll yaw pitch)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_xzy_quat_lh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_xzy_quat_lh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in y x z order in left hand (pitch roll yaw)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_yxz_quat_lh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_yxz_quat_lh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in y z x order in left hand (pitch yaw roll)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_yzx_quat_lh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_yzx_quat_lh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in z x y order in left hand (yaw roll pitch)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_zxy_quat_lh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_zxy_quat_lh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in z y x order in left hand (yaw pitch roll)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_zyx_quat_lh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_zyx_quat_lh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* cglms_euler_to_quat_lh_h */
|
||||||
115
include/cglm/struct/handed/euler_to_quat_rh.h
Normal file
115
include/cglm/struct/handed/euler_to_quat_rh.h
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c), Recep Aslantas.
|
||||||
|
*
|
||||||
|
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||||
|
* Full license can be found in the LICENSE file
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Functions:
|
||||||
|
CGLM_INLINE void glms_euler_xyz_quat_rh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_xzy_quat_rh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_yxz_quat_rh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_yzx_quat_rh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_zxy_quat_rh(vec3 angles, versor dest);
|
||||||
|
CGLM_INLINE void glms_euler_zyx_quat_rh(vec3 angles, versor dest);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cglms_euler_to_quat_rh_h
|
||||||
|
#define cglms_euler_to_quat_rh_h
|
||||||
|
|
||||||
|
#include "../common.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in x y z order in right hand (roll pitch yaw)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_xyz_quat_rh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_xyz_quat_rh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in x z y order in right hand (roll yaw pitch)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_xzy_quat_rh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_xzy_quat_rh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in y x z order in right hand (pitch roll yaw)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_yxz_quat_rh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_yxz_quat_rh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in y z x order in right hand (pitch yaw roll)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_yzx_quat_rh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_yzx_quat_rh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in z x y order in right hand (yaw roll pitch)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_zxy_quat_rh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_zxy_quat_rh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief creates NEW quaternion using rotation angles and does
|
||||||
|
* rotations in z y x order in right hand (yaw pitch roll)
|
||||||
|
*
|
||||||
|
* @param[in] angles angles x y z (radians)
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_euler_zyx_quat_rh(vec3s angles) {
|
||||||
|
versors dest;
|
||||||
|
glm_euler_zyx_quat_rh(angles.raw, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* cglms_euler_to_quat_rh_h */
|
||||||
Reference in New Issue
Block a user