From 039ac92480a09266146fc5b0c9ec67a32a2565ad Mon Sep 17 00:00:00 2001 From: saurabhb17 Date: Wed, 26 Feb 2020 16:04:40 +0530 Subject: Added secondary files --- include/gal/opengl/glm/gtx/euler_angles.inl | 244 ++++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 include/gal/opengl/glm/gtx/euler_angles.inl (limited to 'include/gal/opengl/glm/gtx/euler_angles.inl') diff --git a/include/gal/opengl/glm/gtx/euler_angles.inl b/include/gal/opengl/glm/gtx/euler_angles.inl new file mode 100644 index 0000000..a6ca0ab --- /dev/null +++ b/include/gal/opengl/glm/gtx/euler_angles.inl @@ -0,0 +1,244 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2007-08-14 +// Licence : This source is under MIT License +// File : glm/gtx/euler_angles.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + template + GLM_FUNC_QUALIFIER detail::tmat4x4 eulerAngleX + ( + valType const & angleX + ) + { + valType cosX = glm::cos(angleX); + valType sinX = glm::sin(angleX); + + return detail::tmat4x4( + valType(1), valType(0), valType(0), valType(0), + valType(0), cosX, sinX, valType(0), + valType(0),-sinX, cosX, valType(0), + valType(0), valType(0), valType(0), valType(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 eulerAngleY + ( + valType const & angleY + ) + { + valType cosY = glm::cos(angleY); + valType sinY = glm::sin(angleY); + + return detail::tmat4x4( + cosY, valType(0),-sinY, valType(0), + valType(0), valType(1), valType(0), valType(0), + sinY, valType(0), cosY, valType(0), + valType(0), valType(0), valType(0), valType(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 eulerAngleZ + ( + valType const & angleZ + ) + { + valType cosZ = glm::cos(angleZ); + valType sinZ = glm::sin(angleZ); + + return detail::tmat4x4( + cosZ, sinZ, valType(0), valType(0), + -sinZ, cosZ, valType(0), valType(0), + valType(0), valType(0), valType(1), valType(0), + valType(0), valType(0), valType(0), valType(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 eulerAngleXY + ( + valType const & angleX, + valType const & angleY + ) + { + valType cosX = glm::cos(angleX); + valType sinX = glm::sin(angleX); + valType cosY = glm::cos(angleY); + valType sinY = glm::sin(angleY); + + return detail::tmat4x4( + cosY, -sinX * sinY, cosX * sinY, valType(0), + valType(0), cosX, sinX, valType(0), + -sinY , -sinX * cosY, cosX * cosY, valType(0), + valType(0), valType(0), valType(0), valType(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 eulerAngleYX + ( + valType const & angleY, + valType const & angleX + ) + { + valType cosX = glm::cos(angleX); + valType sinX = glm::sin(angleX); + valType cosY = glm::cos(angleY); + valType sinY = glm::sin(angleY); + + return detail::tmat4x4( + cosY, valType(0), sinY, valType(0), + -sinX * sinY, cosX, sinX * cosY, valType(0), + -cosX * sinY, -sinX, cosX * cosY, valType(0), + valType(0), valType(0), valType(0), valType(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 eulerAngleXZ + ( + valType const & angleX, + valType const & angleZ + ) + { + return eulerAngleX(angleX) * eulerAngleZ(angleZ); + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 eulerAngleZX + ( + valType const & angleZ, + valType const & angleX + ) + { + return eulerAngleZ(angleZ) * eulerAngleX(angleX); + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 eulerAngleYXZ + ( + valType const & yaw, + valType const & pitch, + valType const & roll + ) + { + valType tmp_ch = glm::cos(yaw); + valType tmp_sh = glm::sin(yaw); + valType tmp_cp = glm::cos(pitch); + valType tmp_sp = glm::sin(pitch); + valType tmp_cb = glm::cos(roll); + valType tmp_sb = glm::sin(roll); + + detail::tmat4x4 Result; + Result[0][0] = tmp_ch * tmp_cb + tmp_sh * tmp_sp * tmp_sb; + Result[0][1] = tmp_sb * tmp_cp; + Result[0][2] = -tmp_sh * tmp_cb + tmp_ch * tmp_sp * tmp_sb; + Result[0][3] = valType(0); + Result[1][0] = -tmp_ch * tmp_sb + tmp_sh * tmp_sp * tmp_cb; + Result[1][1] = tmp_cb * tmp_cp; + Result[1][2] = tmp_sb * tmp_sh + tmp_ch * tmp_sp * tmp_cb; + Result[1][3] = valType(0); + Result[2][0] = tmp_sh * tmp_cp; + Result[2][1] = -tmp_sp; + Result[2][2] = tmp_ch * tmp_cp; + Result[2][3] = valType(0); + Result[3][0] = valType(0); + Result[3][1] = valType(0); + Result[3][2] = valType(0); + Result[3][3] = valType(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 yawPitchRoll + ( + valType const & yaw, + valType const & pitch, + valType const & roll + ) + { + valType tmp_ch = glm::cos(yaw); + valType tmp_sh = glm::sin(yaw); + valType tmp_cp = glm::cos(pitch); + valType tmp_sp = glm::sin(pitch); + valType tmp_cb = glm::cos(roll); + valType tmp_sb = glm::sin(roll); + + detail::tmat4x4 Result; + Result[0][0] = tmp_ch * tmp_cb + tmp_sh * tmp_sp * tmp_sb; + Result[0][1] = tmp_sb * tmp_cp; + Result[0][2] = -tmp_sh * tmp_cb + tmp_ch * tmp_sp * tmp_sb; + Result[0][3] = valType(0); + Result[1][0] = -tmp_ch * tmp_sb + tmp_sh * tmp_sp * tmp_cb; + Result[1][1] = tmp_cb * tmp_cp; + Result[1][2] = tmp_sb * tmp_sh + tmp_ch * tmp_sp * tmp_cb; + Result[1][3] = valType(0); + Result[2][0] = tmp_sh * tmp_cp; + Result[2][1] = -tmp_sp; + Result[2][2] = tmp_ch * tmp_cp; + Result[2][3] = valType(0); + Result[3][0] = valType(0); + Result[3][1] = valType(0); + Result[3][2] = valType(0); + Result[3][3] = valType(1); + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat2x2 orientate2 + ( + valType const & angle + ) + { + valType c = glm::cos(angle); + valType s = glm::sin(angle); + + detail::tmat2x2 Result; + Result[0][0] = c; + Result[0][1] = s; + Result[1][0] = -s; + Result[1][1] = c; + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x3 orientate3 + ( + valType const & angle + ) + { + valType c = glm::cos(angle); + valType s = glm::sin(angle); + + detail::tmat3x3 Result; + Result[0][0] = c; + Result[0][1] = s; + Result[0][2] = 0.0f; + Result[1][0] = -s; + Result[1][1] = c; + Result[1][2] = 0.0f; + Result[2][0] = 0.0f; + Result[2][1] = 0.0f; + Result[2][2] = 1.0f; + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x3 orientate3 + ( + detail::tvec3 const & angles + ) + { + return detail::tmat3x3(yawPitchRoll(angles.x, angles.y, angles.z)); + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 orientate4 + ( + detail::tvec3 const & angles + ) + { + return yawPitchRoll(angles.z, angles.x, angles.y); + } +}//namespace glm -- cgit