| 1 | /// @ref core |
| 2 | /// @file glm/matrix.hpp |
| 3 | /// |
| 4 | /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a> |
| 5 | /// |
| 6 | /// @defgroup core_func_matrix Matrix functions |
| 7 | /// @ingroup core |
| 8 | /// |
| 9 | /// Provides GLSL matrix functions. |
| 10 | /// |
| 11 | /// Include <glm/matrix.hpp> to use these core features. |
| 12 | |
| 13 | #pragma once |
| 14 | |
| 15 | // Dependencies |
| 16 | #include "detail/qualifier.hpp" |
| 17 | #include "detail/setup.hpp" |
| 18 | #include "vec2.hpp" |
| 19 | #include "vec3.hpp" |
| 20 | #include "vec4.hpp" |
| 21 | #include "mat2x2.hpp" |
| 22 | #include "mat2x3.hpp" |
| 23 | #include "mat2x4.hpp" |
| 24 | #include "mat3x2.hpp" |
| 25 | #include "mat3x3.hpp" |
| 26 | #include "mat3x4.hpp" |
| 27 | #include "mat4x2.hpp" |
| 28 | #include "mat4x3.hpp" |
| 29 | #include "mat4x4.hpp" |
| 30 | |
| 31 | namespace glm { |
| 32 | namespace detail |
| 33 | { |
| 34 | template<length_t C, length_t R, typename T, qualifier Q> |
| 35 | struct outerProduct_trait{}; |
| 36 | |
| 37 | template<typename T, qualifier Q> |
| 38 | struct outerProduct_trait<2, 2, T, Q> |
| 39 | { |
| 40 | typedef mat<2, 2, T, Q> type; |
| 41 | }; |
| 42 | |
| 43 | template<typename T, qualifier Q> |
| 44 | struct outerProduct_trait<2, 3, T, Q> |
| 45 | { |
| 46 | typedef mat<3, 2, T, Q> type; |
| 47 | }; |
| 48 | |
| 49 | template<typename T, qualifier Q> |
| 50 | struct outerProduct_trait<2, 4, T, Q> |
| 51 | { |
| 52 | typedef mat<4, 2, T, Q> type; |
| 53 | }; |
| 54 | |
| 55 | template<typename T, qualifier Q> |
| 56 | struct outerProduct_trait<3, 2, T, Q> |
| 57 | { |
| 58 | typedef mat<2, 3, T, Q> type; |
| 59 | }; |
| 60 | |
| 61 | template<typename T, qualifier Q> |
| 62 | struct outerProduct_trait<3, 3, T, Q> |
| 63 | { |
| 64 | typedef mat<3, 3, T, Q> type; |
| 65 | }; |
| 66 | |
| 67 | template<typename T, qualifier Q> |
| 68 | struct outerProduct_trait<3, 4, T, Q> |
| 69 | { |
| 70 | typedef mat<4, 3, T, Q> type; |
| 71 | }; |
| 72 | |
| 73 | template<typename T, qualifier Q> |
| 74 | struct outerProduct_trait<4, 2, T, Q> |
| 75 | { |
| 76 | typedef mat<2, 4, T, Q> type; |
| 77 | }; |
| 78 | |
| 79 | template<typename T, qualifier Q> |
| 80 | struct outerProduct_trait<4, 3, T, Q> |
| 81 | { |
| 82 | typedef mat<3, 4, T, Q> type; |
| 83 | }; |
| 84 | |
| 85 | template<typename T, qualifier Q> |
| 86 | struct outerProduct_trait<4, 4, T, Q> |
| 87 | { |
| 88 | typedef mat<4, 4, T, Q> type; |
| 89 | }; |
| 90 | }//namespace detail |
| 91 | |
| 92 | /// @addtogroup core_func_matrix |
| 93 | /// @{ |
| 94 | |
| 95 | /// Multiply matrix x by matrix y component-wise, i.e., |
| 96 | /// result[i][j] is the scalar product of x[i][j] and y[i][j]. |
| 97 | /// |
| 98 | /// @tparam C Integer between 1 and 4 included that qualify the number a column |
| 99 | /// @tparam R Integer between 1 and 4 included that qualify the number a row |
| 100 | /// @tparam T Floating-point scalar types |
| 101 | /// @tparam Q Value from qualifier enum |
| 102 | /// |
| 103 | /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a> |
| 104 | /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a> |
| 105 | template<length_t C, length_t R, typename T, qualifier Q> |
| 106 | GLM_FUNC_DECL mat<C, R, T, Q> matrixCompMult(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y); |
| 107 | |
| 108 | /// Treats the first parameter c as a column vector |
| 109 | /// and the second parameter r as a row vector |
| 110 | /// and does a linear algebraic matrix multiply c * r. |
| 111 | /// |
| 112 | /// @tparam C Integer between 1 and 4 included that qualify the number a column |
| 113 | /// @tparam R Integer between 1 and 4 included that qualify the number a row |
| 114 | /// @tparam T Floating-point scalar types |
| 115 | /// @tparam Q Value from qualifier enum |
| 116 | /// |
| 117 | /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a> |
| 118 | /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a> |
| 119 | template<length_t C, length_t R, typename T, qualifier Q> |
| 120 | GLM_FUNC_DECL typename detail::outerProduct_trait<C, R, T, Q>::type outerProduct(vec<C, T, Q> const& c, vec<R, T, Q> const& r); |
| 121 | |
| 122 | /// Returns the transposed matrix of x |
| 123 | /// |
| 124 | /// @tparam C Integer between 1 and 4 included that qualify the number a column |
| 125 | /// @tparam R Integer between 1 and 4 included that qualify the number a row |
| 126 | /// @tparam T Floating-point scalar types |
| 127 | /// @tparam Q Value from qualifier enum |
| 128 | /// |
| 129 | /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a> |
| 130 | /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a> |
| 131 | template<length_t C, length_t R, typename T, qualifier Q> |
| 132 | GLM_FUNC_DECL typename mat<C, R, T, Q>::transpose_type transpose(mat<C, R, T, Q> const& x); |
| 133 | |
| 134 | /// Return the determinant of a squared matrix. |
| 135 | /// |
| 136 | /// @tparam C Integer between 1 and 4 included that qualify the number a column |
| 137 | /// @tparam R Integer between 1 and 4 included that qualify the number a row |
| 138 | /// @tparam T Floating-point scalar types |
| 139 | /// @tparam Q Value from qualifier enum |
| 140 | /// |
| 141 | /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a> |
| 142 | /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a> |
| 143 | template<length_t C, length_t R, typename T, qualifier Q> |
| 144 | GLM_FUNC_DECL T determinant(mat<C, R, T, Q> const& m); |
| 145 | |
| 146 | /// Return the inverse of a squared matrix. |
| 147 | /// |
| 148 | /// @tparam C Integer between 1 and 4 included that qualify the number a column |
| 149 | /// @tparam R Integer between 1 and 4 included that qualify the number a row |
| 150 | /// @tparam T Floating-point scalar types |
| 151 | /// @tparam Q Value from qualifier enum |
| 152 | /// |
| 153 | /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a> |
| 154 | /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a> |
| 155 | template<length_t C, length_t R, typename T, qualifier Q> |
| 156 | GLM_FUNC_DECL mat<C, R, T, Q> inverse(mat<C, R, T, Q> const& m); |
| 157 | |
| 158 | /// @} |
| 159 | }//namespace glm |
| 160 | |
| 161 | #include "detail/func_matrix.inl" |