1 /////////////////////////////////////////////////////////////////////////////////// 2 /// OpenGL Mathematics (glm.g-truc.net) 3 /// 4 /// Copyright (c) 2005 - 2014 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_matrix_transform_2d 24 /// @file glm/gtx/matrix_transform_2d.hpp 25 /// @date 2014-02-20 26 /// @author Miguel ngel Prez Martnez 27 /// 28 /// @see core (dependence) 29 /// 30 /// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d 31 /// @ingroup gtx 32 /// 33 /// @brief Defines functions that generate common 2d transformation matrices. 34 /// 35 /// <glm/gtx/matrix_transform_2d.hpp> need to be included to use these functionalities. 36 /////////////////////////////////////////////////////////////////////////////////// 37 38 #ifndef GLM_GTX_matrix_transform_2d 39 #define GLM_GTX_matrix_transform_2d 40 41 // Dependency: 42 #include "../mat3x3.hpp" 43 #include "../vec2.hpp" 44 45 46 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) 47 # pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") 48 #endif 49 50 namespace glm 51 { 52 /// @addtogroup gtx_matrix_transform_2d 53 /// @{ 54 55 /// Builds a translation 3 * 3 matrix created from a vector of 2 components. 56 /// 57 /// @param m Input matrix multiplied by this translation matrix. 58 /// @param v Coordinates of a translation vector. 59 template <typename T, precision P> 60 GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> translate( 61 detail::tmat3x3<T, P> const & m, 62 detail::tvec2<T, P> const & v); 63 64 /// Builds a rotation 3 * 3 matrix created from an angle. 65 /// 66 /// @param m Input matrix multiplied by this translation matrix. 67 /// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise. 68 template <typename T, precision P> 69 GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> rotate( 70 detail::tmat3x3<T, P> const & m, 71 T const & angle); 72 73 /// Builds a scale 3 * 3 matrix created from a vector of 2 components. 74 /// 75 /// @param m Input matrix multiplied by this translation matrix. 76 /// @param v Coordinates of a scale vector. 77 template <typename T, precision P> 78 GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> scale( 79 detail::tmat3x3<T, P> const & m, 80 detail::tvec2<T, P> const & v); 81 82 /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix. 83 /// 84 /// @param m Input matrix multiplied by this translation matrix. 85 /// @param y Shear factor. 86 template <typename T, precision P> 87 GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearX( 88 detail::tmat3x3<T, P> const & m, 89 T const & y); 90 91 /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix. 92 /// 93 /// @param m Input matrix multiplied by this translation matrix. 94 /// @param x Shear factor. 95 template <typename T, precision P> 96 GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearY( 97 detail::tmat3x3<T, P> const & m, 98 T const & x); 99 100 /// @} 101 }//namespace glm 102 103 #include "matrix_transform_2d.inl" 104 105 #endif//GLM_GTX_matrix_transform_2d 106