rotate_normalized_axis.hpp 2.2 KB

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