You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
4.3 KiB

5 years ago
  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
  5. /// Permission is hereby granted, free of charge, to any person obtaining a copy
  6. /// of this software and associated documentation files (the "Software"), to deal
  7. /// in the Software without restriction, including without limitation the rights
  8. /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. /// copies of the Software, and to permit persons to whom the Software is
  10. /// furnished to do so, subject to the following conditions:
  11. ///
  12. /// The above copyright notice and this permission notice shall be included in
  13. /// all copies or substantial portions of the Software.
  14. ///
  15. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. /// THE SOFTWARE.
  22. ///
  23. /// @ref gtx_rotate_vector
  24. /// @file glm/gtx/rotate_vector.hpp
  25. /// @date 2006-11-02 / 2011-06-07
  26. /// @author Christophe Riccio
  27. ///
  28. /// @see core (dependence)
  29. /// @see gtx_transform (dependence)
  30. ///
  31. /// @defgroup gtx_rotate_vector GLM_GTX_rotate_vector
  32. /// @ingroup gtx
  33. ///
  34. /// @brief Function to directly rotate a vector
  35. ///
  36. /// <glm/gtx/rotate_vector.hpp> need to be included to use these functionalities.
  37. ///////////////////////////////////////////////////////////////////////////////////
  38. #ifndef GLM_GTX_rotate_vector
  39. #define GLM_GTX_rotate_vector GLM_VERSION
  40. // Dependency:
  41. #include "../glm.hpp"
  42. #include "../gtx/transform.hpp"
  43. #if(defined(GLM_MESSAGES) && !defined(glm_ext))
  44. # pragma message("GLM: GLM_GTX_rotate_vector extension included")
  45. #endif
  46. namespace glm
  47. {
  48. /// @addtogroup gtx_rotate_vector
  49. /// @{
  50. //! Rotate a two dimensional vector.
  51. //! From GLM_GTX_rotate_vector extension.
  52. template <typename T>
  53. detail::tvec2<T> rotate(
  54. detail::tvec2<T> const & v,
  55. T const & angle);
  56. //! Rotate a three dimensional vector around an axis.
  57. //! From GLM_GTX_rotate_vector extension.
  58. template <typename T>
  59. detail::tvec3<T> rotate(
  60. detail::tvec3<T> const & v,
  61. T const & angle,
  62. detail::tvec3<T> const & normal);
  63. //! Rotate a four dimensional vector around an axis.
  64. //! From GLM_GTX_rotate_vector extension.
  65. template <typename T>
  66. detail::tvec4<T> rotate(
  67. detail::tvec4<T> const & v,
  68. T const & angle,
  69. detail::tvec3<T> const & normal);
  70. //! Rotate a three dimensional vector around the X axis.
  71. //! From GLM_GTX_rotate_vector extension.
  72. template <typename T>
  73. detail::tvec3<T> rotateX(
  74. detail::tvec3<T> const & v,
  75. T const & angle);
  76. //! Rotate a three dimensional vector around the Y axis.
  77. //! From GLM_GTX_rotate_vector extension.
  78. template <typename T>
  79. detail::tvec3<T> rotateY(
  80. detail::tvec3<T> const & v,
  81. T const & angle);
  82. //! Rotate a three dimensional vector around the Z axis.
  83. //! From GLM_GTX_rotate_vector extension.
  84. template <typename T>
  85. detail::tvec3<T> rotateZ(
  86. detail::tvec3<T> const & v,
  87. T const & angle);
  88. //! Rotate a four dimentionnals vector around the X axis.
  89. //! From GLM_GTX_rotate_vector extension.
  90. template <typename T>
  91. detail::tvec4<T> rotateX(
  92. detail::tvec4<T> const & v,
  93. T const & angle);
  94. //! Rotate a four dimensional vector around the X axis.
  95. //! From GLM_GTX_rotate_vector extension.
  96. template <typename T>
  97. detail::tvec4<T> rotateY(
  98. detail::tvec4<T> const & v,
  99. T const & angle);
  100. //! Rotate a four dimensional vector around the X axis.
  101. //! From GLM_GTX_rotate_vector extension.
  102. template <typename T>
  103. detail::tvec4<T> rotateZ(
  104. detail::tvec4<T> const & v,
  105. T const & angle);
  106. //! Build a rotation matrix from a normal and a up vector.
  107. //! From GLM_GTX_rotate_vector extension.
  108. template <typename T>
  109. detail::tmat4x4<T> orientation(
  110. detail::tvec3<T> const & Normal,
  111. detail::tvec3<T> const & Up);
  112. /// @}
  113. }//namespace glm
  114. #include "rotate_vector.inl"
  115. #endif//GLM_GTX_rotate_vector