rotate_normalized_axis.hpp 2.2 KB

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