1 /// @ref gtx_rotate_normalized_axis 2 /// @file glm/gtx/rotate_normalized_axis.hpp 3 /// 4 /// @see core (dependence) 5 /// @see gtc_matrix_transform 6 /// @see gtc_quaternion 7 /// 8 /// @defgroup gtx_rotate_normalized_axis GLM_GTX_rotate_normalized_axis 9 /// @ingroup gtx 10 /// 11 /// @brief Quaternions and matrices rotations around normalized axis. 12 /// 13 /// <glm/gtx/rotate_normalized_axis.hpp> need to be included to use these functionalities. 14 15 #pragma once 16 17 // Dependency: 18 #include "../glm.hpp" 19 #include "../gtc/epsilon.hpp" 20 #include "../gtc/quaternion.hpp" 21 22 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 # pragma message("GLM: GLM_GTX_rotate_normalized_axis extension included") 24 #endif 25 26 namespace glm 27 { 28 /// @addtogroup gtx_rotate_normalized_axis 29 /// @{ 30 31 /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle. 32 /// 33 /// @param m Input matrix multiplied by this rotation matrix. 34 /// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. 35 /// @param axis Rotation axis, must be normalized. 36 /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. 37 /// 38 /// @see gtx_rotate_normalized_axis 39 /// @see - rotate(T angle, T x, T y, T z) 40 /// @see - rotate(tmat4x4<T, P> const & m, T angle, T x, T y, T z) 41 /// @see - rotate(T angle, tvec3<T, P> const & v) 42 template <typename T, precision P> 43 GLM_FUNC_DECL tmat4x4<T, P> rotateNormalizedAxis( 44 tmat4x4<T, P> const & m, 45 T const & angle, 46 tvec3<T, P> const & axis); 47 48 /// Rotates a quaternion from a vector of 3 components normalized axis and an angle. 49 /// 50 /// @param q Source orientation 51 /// @param angle Angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. 52 /// @param axis Normalized axis of the rotation, must be normalized. 53 /// 54 /// @see gtx_rotate_normalized_axis 55 template <typename T, precision P> 56 GLM_FUNC_DECL tquat<T, P> rotateNormalizedAxis( 57 tquat<T, P> const & q, 58 T const & angle, 59 tvec3<T, P> const & axis); 60 61 /// @} 62 }//namespace glm 63 64 #include "rotate_normalized_axis.inl" 65