1 /////////////////////////////////////////////////////////////////////////////////// 2 /// OpenGL Mathematics (glm.g-truc.net) 3 /// 4 /// Copyright (c) 2005 - 2012 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_normalized_axis 24 /// @file glm/gtx/rotate_normalized_axis.hpp 25 /// @date 2012-12-13 / 2012-12-13 26 /// @author Christophe Riccio 27 /// 28 /// @see core (dependence) 29 /// @see gtc_matrix_transform 30 /// @see gtc_quaternion 31 /// 32 /// @defgroup gtx_rotate_normalized_axis GLM_GTX_rotate_normalized_axis 33 /// @ingroup gtc 34 /// 35 /// @brief Quaternions and matrices rotations around normalized axis. 36 /// 37 /// <glm/gtx/rotate_normalized_axis.hpp> need to be included to use these functionalities. 38 /////////////////////////////////////////////////////////////////////////////////// 39 40 #ifndef GLM_GTX_rotate_normalized_axis 41 #define GLM_GTX_rotate_normalized_axis 42 43 // Dependency: 44 #include "../glm.hpp" 45 #include "../gtc/epsilon.hpp" 46 #include "../gtc/quaternion.hpp" 47 48 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) 49 # pragma message("GLM: GLM_GTX_rotate_normalized_axis extension included") 50 #endif 51 52 namespace glm 53 { 54 /// @addtogroup gtx_rotate_normalized_axis 55 /// @{ 56 57 /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle. 58 /// 59 /// @param m Input matrix multiplied by this rotation matrix. 60 /// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. 61 /// @param axis Rotation axis, must be normalized. 62 /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. 63 /// 64 /// @see gtx_rotate_normalized_axis 65 /// @see - rotate(T angle, T x, T y, T z) 66 /// @see - rotate(detail::tmat4x4<T, P> const & m, T angle, T x, T y, T z) 67 /// @see - rotate(T angle, detail::tvec3<T, P> const & v) 68 template <typename T, precision P> 69 GLM_FUNC_DECL detail::tmat4x4<T, P> rotateNormalizedAxis( 70 detail::tmat4x4<T, P> const & m, 71 T const & angle, 72 detail::tvec3<T, P> const & axis); 73 74 /// Rotates a quaternion from a vector of 3 components normalized axis and an angle. 75 /// 76 /// @param q Source orientation 77 /// @param angle Angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. 78 /// @param axis Normalized axis of the rotation, must be normalized. 79 /// 80 /// @see gtx_rotate_normalized_axis 81 template <typename T, precision P> 82 GLM_FUNC_DECL detail::tquat<T, P> rotateNormalizedAxis( 83 detail::tquat<T, P> const & q, 84 T const & angle, 85 detail::tvec3<T, P> const & axis); 86 87 /// @} 88 }//namespace glm 89 90 #include "rotate_normalized_axis.inl" 91 92 #endif//GLM_GTX_rotate_normalized_axis 93