| 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 | /// Include <glm/gtx/rotate_normalized_axis.hpp> to use the features of this extension. |
| 12 | /// |
| 13 | /// Quaternions and matrices rotations around normalized axis. |
| 14 | |
| 15 | #pragma once |
| 16 | |
| 17 | // Dependency: |
| 18 | #include "../glm.hpp" |
| 19 | #include "../gtc/epsilon.hpp" |
| 20 | #include "../gtc/quaternion.hpp" |
| 21 | |
| 22 | #ifndef GLM_ENABLE_EXPERIMENTAL |
| 23 | # error "GLM: GLM_GTX_rotate_normalized_axis is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." |
| 24 | #endif |
| 25 | |
| 26 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
| 27 | # pragma message("GLM: GLM_GTX_rotate_normalized_axis extension included") |
| 28 | #endif |
| 29 | |
| 30 | namespace glm |
| 31 | { |
| 32 | /// @addtogroup gtx_rotate_normalized_axis |
| 33 | /// @{ |
| 34 | |
| 35 | /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle. |
| 36 | /// |
| 37 | /// @param m Input matrix multiplied by this rotation matrix. |
| 38 | /// @param angle Rotation angle expressed in radians. |
| 39 | /// @param axis Rotation axis, must be normalized. |
| 40 | /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double. |
| 41 | /// |
| 42 | /// @see gtx_rotate_normalized_axis |
| 43 | /// @see - rotate(T angle, T x, T y, T z) |
| 44 | /// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z) |
| 45 | /// @see - rotate(T angle, vec<3, T, Q> const& v) |
| 46 | template<typename T, qualifier Q> |
| 47 | GLM_FUNC_DECL mat<4, 4, T, Q> rotateNormalizedAxis( |
| 48 | mat<4, 4, T, Q> const& m, |
| 49 | T const& angle, |
| 50 | vec<3, T, Q> const& axis); |
| 51 | |
| 52 | /// Rotates a quaternion from a vector of 3 components normalized axis and an angle. |
| 53 | /// |
| 54 | /// @param q Source orientation |
| 55 | /// @param angle Angle expressed in radians. |
| 56 | /// @param axis Normalized axis of the rotation, must be normalized. |
| 57 | /// |
| 58 | /// @see gtx_rotate_normalized_axis |
| 59 | template<typename T, qualifier Q> |
| 60 | GLM_FUNC_DECL qua<T, Q> rotateNormalizedAxis( |
| 61 | qua<T, Q> const& q, |
| 62 | T const& angle, |
| 63 | vec<3, T, Q> const& axis); |
| 64 | |
| 65 | /// @} |
| 66 | }//namespace glm |
| 67 | |
| 68 | #include "rotate_normalized_axis.inl" |