mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 12:41:54 +00:00
Added creating a derived matrix from the rotation matrix.
Creating a derived matrix from the rotation matrix about the x-, y-, and z-axis.
This commit is contained in:
parent
be53cebcd3
commit
5fe5f32edd
@ -46,6 +46,24 @@ namespace glm
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZ(
|
||||
T const& angleZ);
|
||||
|
||||
/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about X-axis.
|
||||
/// @see gtx_euler_angles
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleX(
|
||||
T const & angleX, T const & angularVelocityX);
|
||||
|
||||
/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about Y-axis.
|
||||
/// @see gtx_euler_angles
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleY(
|
||||
T const & angleY, T const & angularVelocityY);
|
||||
|
||||
/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about Z-axis.
|
||||
/// @see gtx_euler_angles
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleZ(
|
||||
T const & angleZ, T const & angularVelocityZ);
|
||||
|
||||
/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y).
|
||||
/// @see gtx_euler_angles
|
||||
template<typename T>
|
||||
|
@ -53,6 +53,57 @@ namespace glm
|
||||
T(0), T(0), T(0), T(1));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> derivedEulerAngleX
|
||||
(
|
||||
T const & angleX,
|
||||
T const & angularVelocityX
|
||||
)
|
||||
{
|
||||
T cosX = glm::cos(angleX) * angularVelocityX;
|
||||
T sinX = glm::sin(angleX) * angularVelocityX;
|
||||
|
||||
return mat<4, 4, T, defaultp>(
|
||||
T(0), T(0), T(0), T(0),
|
||||
T(0),-sinX, cosX, T(0),
|
||||
T(0),-cosX,-sinX, T(0),
|
||||
T(0), T(0), T(0), T(0));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> derivedEulerAngleY
|
||||
(
|
||||
T const & angleY,
|
||||
T const & angularVelocityY
|
||||
)
|
||||
{
|
||||
T cosY = glm::cos(angleY) * angularVelocityY;
|
||||
T sinY = glm::sin(angleY) * angularVelocityY;
|
||||
|
||||
return mat<4, 4, T, defaultp>(
|
||||
-sinY, T(0), -cosY, T(0),
|
||||
T(0), T(0), T(0), T(0),
|
||||
cosY, T(0), -sinY, T(0),
|
||||
T(0), T(0), T(0), T(0));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> derivedEulerAngleZ
|
||||
(
|
||||
T const & angleZ,
|
||||
T const & angularVelocityZ
|
||||
)
|
||||
{
|
||||
T cosZ = glm::cos(angleZ) * angularVelocityZ;
|
||||
T sinZ = glm::sin(angleZ) * angularVelocityZ;
|
||||
|
||||
return mat<4, 4, T, defaultp>(
|
||||
-sinZ, cosZ, T(0), T(0),
|
||||
-cosZ, -sinZ, T(0), T(0),
|
||||
T(0), T(0), T(0), T(0),
|
||||
T(0), T(0), T(0), T(0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> eulerAngleXY
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user