1 /// @ref gtx_rotate_vector 2 /// @file glm/gtx/rotate_vector.hpp 3 /// 4 /// @see core (dependence) 5 /// @see gtx_transform (dependence) 6 /// 7 /// @defgroup gtx_rotate_vector GLM_GTX_rotate_vector 8 /// @ingroup gtx 9 /// 10 /// @brief Function to directly rotate a vector 11 /// 12 /// <glm/gtx/rotate_vector.hpp> need to be included to use these functionalities. 13 14 #pragma once 15 16 // Dependency: 17 #include "../glm.hpp" 18 #include "../gtx/transform.hpp" 19 20 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 # pragma message("GLM: GLM_GTX_rotate_vector extension included") 22 #endif 23 24 namespace glm 25 { 26 /// @addtogroup gtx_rotate_vector 27 /// @{ 28 29 /// Returns Spherical interpolation between two vectors 30 /// 31 /// @param x A first vector 32 /// @param y A second vector 33 /// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1]. 34 /// 35 /// @see gtx_rotate_vector 36 template <typename T, precision P> 37 GLM_FUNC_DECL tvec3<T, P> slerp( 38 tvec3<T, P> const & x, 39 tvec3<T, P> const & y, 40 T const & a); 41 42 //! Rotate a two dimensional vector. 43 //! From GLM_GTX_rotate_vector extension. 44 template <typename T, precision P> 45 GLM_FUNC_DECL tvec2<T, P> rotate( 46 tvec2<T, P> const & v, 47 T const & angle); 48 49 //! Rotate a three dimensional vector around an axis. 50 //! From GLM_GTX_rotate_vector extension. 51 template <typename T, precision P> 52 GLM_FUNC_DECL tvec3<T, P> rotate( 53 tvec3<T, P> const & v, 54 T const & angle, 55 tvec3<T, P> const & normal); 56 57 //! Rotate a four dimensional vector around an axis. 58 //! From GLM_GTX_rotate_vector extension. 59 template <typename T, precision P> 60 GLM_FUNC_DECL tvec4<T, P> rotate( 61 tvec4<T, P> const & v, 62 T const & angle, 63 tvec3<T, P> const & normal); 64 65 //! Rotate a three dimensional vector around the X axis. 66 //! From GLM_GTX_rotate_vector extension. 67 template <typename T, precision P> 68 GLM_FUNC_DECL tvec3<T, P> rotateX( 69 tvec3<T, P> const & v, 70 T const & angle); 71 72 //! Rotate a three dimensional vector around the Y axis. 73 //! From GLM_GTX_rotate_vector extension. 74 template <typename T, precision P> 75 GLM_FUNC_DECL tvec3<T, P> rotateY( 76 tvec3<T, P> const & v, 77 T const & angle); 78 79 //! Rotate a three dimensional vector around the Z axis. 80 //! From GLM_GTX_rotate_vector extension. 81 template <typename T, precision P> 82 GLM_FUNC_DECL tvec3<T, P> rotateZ( 83 tvec3<T, P> const & v, 84 T const & angle); 85 86 //! Rotate a four dimentionnals vector around the X axis. 87 //! From GLM_GTX_rotate_vector extension. 88 template <typename T, precision P> 89 GLM_FUNC_DECL tvec4<T, P> rotateX( 90 tvec4<T, P> const & v, 91 T const & angle); 92 93 //! Rotate a four dimensional vector around the X axis. 94 //! From GLM_GTX_rotate_vector extension. 95 template <typename T, precision P> 96 GLM_FUNC_DECL tvec4<T, P> rotateY( 97 tvec4<T, P> const & v, 98 T const & angle); 99 100 //! Rotate a four dimensional vector around the X axis. 101 //! From GLM_GTX_rotate_vector extension. 102 template <typename T, precision P> 103 GLM_FUNC_DECL tvec4<T, P> rotateZ( 104 tvec4<T, P> const & v, 105 T const & angle); 106 107 //! Build a rotation matrix from a normal and a up vector. 108 //! From GLM_GTX_rotate_vector extension. 109 template <typename T, precision P> 110 GLM_FUNC_DECL tmat4x4<T, P> orientation( 111 tvec3<T, P> const & Normal, 112 tvec3<T, P> const & Up); 113 114 /// @} 115 }//namespace glm 116 117 #include "rotate_vector.inl" 118