rotate_normalized_axis.hpp 2.2 KB

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