0.9.9 API documentation
type_mat2x2.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "type_vec2.hpp"
7 #include <limits>
8 #include <cstddef>
9 
10 namespace glm
11 {
12  template<typename T, qualifier Q>
13  struct mat<2, 2, T, Q>
14  {
15  typedef vec<2, T, Q> col_type;
16  typedef vec<2, T, Q> row_type;
17  typedef mat<2, 2, T, Q> type;
18  typedef mat<2, 2, T, Q> transpose_type;
19  typedef T value_type;
20 
21  private:
22  col_type value[2];
23 
24  public:
25  // -- Accesses --
26 
27  typedef length_t length_type;
28  GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }
29 
30  GLM_FUNC_DECL col_type & operator[](length_type i);
31  GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
32 
33  // -- Constructors --
34 
35  GLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;
36  template<qualifier P>
37  GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 2, T, P> const& m);
38 
39  GLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);
40  GLM_FUNC_DECL GLM_CONSTEXPR mat(
41  T const& x1, T const& y1,
42  T const& x2, T const& y2);
43  GLM_FUNC_DECL GLM_CONSTEXPR mat(
44  col_type const& v1,
45  col_type const& v2);
46 
47  // -- Conversions --
48 
49  template<typename U, typename V, typename M, typename N>
50  GLM_FUNC_DECL GLM_CONSTEXPR mat(
51  U const& x1, V const& y1,
52  M const& x2, N const& y2);
53 
54  template<typename U, typename V>
55  GLM_FUNC_DECL GLM_CONSTEXPR mat(
56  vec<2, U, Q> const& v1,
57  vec<2, V, Q> const& v2);
58 
59  // -- Matrix conversions --
60 
61  template<typename U, qualifier P>
62  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, U, P> const& m);
63 
64  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);
65  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);
66  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);
67  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);
68  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);
69  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);
70  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);
71  GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);
72 
73  // -- Unary arithmetic operators --
74 
75  template<typename U>
76  GLM_FUNC_DECL mat<2, 2, T, Q> & operator=(mat<2, 2, U, Q> const& m);
77  template<typename U>
78  GLM_FUNC_DECL mat<2, 2, T, Q> & operator+=(U s);
79  template<typename U>
80  GLM_FUNC_DECL mat<2, 2, T, Q> & operator+=(mat<2, 2, U, Q> const& m);
81  template<typename U>
82  GLM_FUNC_DECL mat<2, 2, T, Q> & operator-=(U s);
83  template<typename U>
84  GLM_FUNC_DECL mat<2, 2, T, Q> & operator-=(mat<2, 2, U, Q> const& m);
85  template<typename U>
86  GLM_FUNC_DECL mat<2, 2, T, Q> & operator*=(U s);
87  template<typename U>
88  GLM_FUNC_DECL mat<2, 2, T, Q> & operator*=(mat<2, 2, U, Q> const& m);
89  template<typename U>
90  GLM_FUNC_DECL mat<2, 2, T, Q> & operator/=(U s);
91  template<typename U>
92  GLM_FUNC_DECL mat<2, 2, T, Q> & operator/=(mat<2, 2, U, Q> const& m);
93 
94  // -- Increment and decrement operators --
95 
96  GLM_FUNC_DECL mat<2, 2, T, Q> & operator++ ();
97  GLM_FUNC_DECL mat<2, 2, T, Q> & operator-- ();
98  GLM_FUNC_DECL mat<2, 2, T, Q> operator++(int);
99  GLM_FUNC_DECL mat<2, 2, T, Q> operator--(int);
100  };
101 
102  // -- Unary operators --
103 
104  template<typename T, qualifier Q>
105  GLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m);
106 
107  template<typename T, qualifier Q>
108  GLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m);
109 
110  // -- Binary operators --
111 
112  template<typename T, qualifier Q>
113  GLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m, T scalar);
114 
115  template<typename T, qualifier Q>
116  GLM_FUNC_DECL mat<2, 2, T, Q> operator+(T scalar, mat<2, 2, T, Q> const& m);
117 
118  template<typename T, qualifier Q>
119  GLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
120 
121  template<typename T, qualifier Q>
122  GLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m, T scalar);
123 
124  template<typename T, qualifier Q>
125  GLM_FUNC_DECL mat<2, 2, T, Q> operator-(T scalar, mat<2, 2, T, Q> const& m);
126 
127  template<typename T, qualifier Q>
128  GLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
129 
130  template<typename T, qualifier Q>
131  GLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m, T scalar);
132 
133  template<typename T, qualifier Q>
134  GLM_FUNC_DECL mat<2, 2, T, Q> operator*(T scalar, mat<2, 2, T, Q> const& m);
135 
136  template<typename T, qualifier Q>
137  GLM_FUNC_DECL typename mat<2, 2, T, Q>::col_type operator*(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);
138 
139  template<typename T, qualifier Q>
140  GLM_FUNC_DECL typename mat<2, 2, T, Q>::row_type operator*(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);
141 
142  template<typename T, qualifier Q>
143  GLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
144 
145  template<typename T, qualifier Q>
146  GLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
147 
148  template<typename T, qualifier Q>
149  GLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
150 
151  template<typename T, qualifier Q>
152  GLM_FUNC_DECL mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m, T scalar);
153 
154  template<typename T, qualifier Q>
155  GLM_FUNC_DECL mat<2, 2, T, Q> operator/(T scalar, mat<2, 2, T, Q> const& m);
156 
157  template<typename T, qualifier Q>
158  GLM_FUNC_DECL typename mat<2, 2, T, Q>::col_type operator/(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);
159 
160  template<typename T, qualifier Q>
161  GLM_FUNC_DECL typename mat<2, 2, T, Q>::row_type operator/(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);
162 
163  template<typename T, qualifier Q>
164  GLM_FUNC_DECL mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
165 
166  // -- Boolean operators --
167 
168  template<typename T, qualifier Q>
169  GLM_FUNC_DECL bool operator==(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
170 
171  template<typename T, qualifier Q>
172  GLM_FUNC_DECL bool operator!=(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
173 } //namespace glm
174 
175 #ifndef GLM_EXTERNAL_TEMPLATE
176 #include "type_mat2x2.inl"
177 #endif
Core features
GLM_FUNC_DECL T length(qua< T, Q > const &q)
Returns the norm of a quaternions.
Definition: common.hpp:20