GLM 0.9.5

- Main Page
- Related Pages
- Modules
- Namespaces
- Files

- File List

type_mat2x2.hpp
1
29 #ifndef glm_core_type_mat2x2
30 #define glm_core_type_mat2x2
31
32 #include "../fwd.hpp"
33 #include "type_vec2.hpp"
34 #include "type_mat.hpp"
35 #include <limits>
36
37 namespace glm{
38 namespace detail
39 {
40 template <typename T, precision P>
41 struct tmat2x2
42 {
43 enum ctor{_null};
44 typedef T value_type;
45 typedef std::size_t size_type;
46 typedef tvec2<T, P> col_type;
47 typedef tvec2<T, P> row_type;
48 typedef tmat2x2<T, P> type;
49 typedef tmat2x2<T, P> transpose_type;
50
51 GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
52
53 template <typename U, precision Q>
54 friend tmat2x2<U, Q> inverse(tmat2x2<U, Q> const & m);
55 template <typename U, precision Q>
56 friend tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
57 template <typename U, precision Q>
58 friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);
59
60 private:
62 col_type value[2];
63
64 GLM_FUNC_DECL tmat2x2<T, P> _inverse() const;
66
67 public:
69 // Constructors
70 GLM_FUNC_DECL tmat2x2();
71 GLM_FUNC_DECL tmat2x2(tmat2x2<T, P> const & m);
72 template <precision Q>
73 GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m);
74
75 GLM_FUNC_DECL explicit tmat2x2(
76 ctor Null);
77 GLM_FUNC_DECL explicit tmat2x2(
78 T const & x);
79 GLM_FUNC_DECL explicit tmat2x2(
80 T const & x1, T const & y1,
81 T const & x2, T const & y2);
82 GLM_FUNC_DECL explicit tmat2x2(
83 col_type const & v1,
84 col_type const & v2);
85
86 #if(GLM_HAS_INITIALIZER_LISTS)
87 template <typename U>
88 GLM_FUNC_DECL tmat2x2(std::initializer_list<U> m);
89
90 GLM_FUNC_DECL tmat2x2(std::initializer_list<tvec2<T, P> > m);
91 #endif//GLM_HAS_INITIALIZER_LISTS
92
94 // Conversions
95 template <typename U>
96 GLM_FUNC_DECL explicit tmat2x2(
97 U const & x);
98
99 template <typename U, typename V, typename M, typename N>
100 GLM_FUNC_DECL explicit tmat2x2(
101 U const & x1, V const & y1,
102 M const & x2, N const & y2);
103
104 template <typename U, typename V>
105 GLM_FUNC_DECL explicit tmat2x2(
106 tvec2<U, P> const & v1,
107 tvec2<V, P> const & v2);
108
110 // Matrix conversions
111 template <typename U, precision Q>
112 GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U, Q> const & m);
113
114 GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x);
115 GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x);
116 GLM_FUNC_DECL explicit tmat2x2(tmat2x3<T, P> const & x);
117 GLM_FUNC_DECL explicit tmat2x2(tmat3x2<T, P> const & x);
118 GLM_FUNC_DECL explicit tmat2x2(tmat2x4<T, P> const & x);
119 GLM_FUNC_DECL explicit tmat2x2(tmat4x2<T, P> const & x);
120 GLM_FUNC_DECL explicit tmat2x2(tmat3x4<T, P> const & x);
121 GLM_FUNC_DECL explicit tmat2x2(tmat4x3<T, P> const & x);
122
124 // Accesses
125
126 GLM_FUNC_DECL col_type & operator[](length_t i);
127 GLM_FUNC_DECL col_type const & operator[](length_t i) const;
128
129 // Unary updatable operators
130 GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & m);
131 template <typename U>
132 GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<U, P> const & m);
133 template <typename U>
134 GLM_FUNC_DECL tmat2x2<T, P> & operator+=(U s);
135 template <typename U>
136 GLM_FUNC_DECL tmat2x2<T, P> & operator+=(tmat2x2<U, P> const & m);
137 template <typename U>
138 GLM_FUNC_DECL tmat2x2<T, P> & operator-=(U s);
139 template <typename U>
140 GLM_FUNC_DECL tmat2x2<T, P> & operator-=(tmat2x2<U, P> const & m);
141 template <typename U>
142 GLM_FUNC_DECL tmat2x2<T, P> & operator*=(U s);
143 template <typename U>
144 GLM_FUNC_DECL tmat2x2<T, P> & operator*=(tmat2x2<U, P> const & m);
145 template <typename U>
146 GLM_FUNC_DECL tmat2x2<T, P> & operator/=(U s);
147 template <typename U>
148 GLM_FUNC_DECL tmat2x2<T, P> & operator/=(tmat2x2<U, P> const & m);
149
151 // Increment and decrement operators
152
153 GLM_FUNC_DECL tmat2x2<T, P> & operator++ ();
154 GLM_FUNC_DECL tmat2x2<T, P> & operator-- ();
155 GLM_FUNC_DECL tmat2x2<T, P> operator++(int);
156 GLM_FUNC_DECL tmat2x2<T, P> operator--(int);
157 };
158
159 // Binary operators
160
161 template <typename T, precision P>
162 GLM_FUNC_DECL tmat2x2<T, P> operator+ (
163 tmat2x2<T, P> const & m,
164 T const & s);
165
166 template <typename T, precision P>
167 GLM_FUNC_DECL tmat2x2<T, P> operator+ (
168 T const & s,
169 tmat2x2<T, P> const & m);
170
171 template <typename T, precision P>
172 GLM_FUNC_DECL tmat2x2<T, P> operator+ (
173 tmat2x2<T, P> const & m1,
174 tmat2x2<T, P> const & m2);
175
176 template <typename T, precision P>
177 GLM_FUNC_DECL tmat2x2<T, P> operator- (
178 tmat2x2<T, P> const & m,
179 T const & s);
180
181 template <typename T, precision P>
182 GLM_FUNC_DECL tmat2x2<T, P> operator- (
183 T const & s,
184 tmat2x2<T, P> const & m);
185
186 template <typename T, precision P>
187 GLM_FUNC_DECL tmat2x2<T, P> operator- (
188 tmat2x2<T, P> const & m1,
189 tmat2x2<T, P> const & m2);
190
191 template <typename T, precision P>
192 GLM_FUNC_DECL tmat2x2<T, P> operator* (
193 tmat2x2<T, P> const & m,
194 T const & s);
195
196 template <typename T, precision P>
197 GLM_FUNC_DECL tmat2x2<T, P> operator* (
198 T const & s,
199 tmat2x2<T, P> const & m);
200
201 template <typename T, precision P>
202 GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator* (
203 tmat2x2<T, P> const & m,
204 typename tmat2x2<T, P>::row_type const & v);
205
206 template <typename T, precision P>
207 GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator* (
208 typename tmat2x2<T, P>::col_type const & v,
209 tmat2x2<T, P> const & m);
210
211 template <typename T, precision P>
212 GLM_FUNC_DECL tmat2x2<T, P> operator* (
213 tmat2x2<T, P> const & m1,
214 tmat2x2<T, P> const & m2);
215
216 template <typename T, precision P>
217 GLM_FUNC_DECL tmat3x2<T, P> operator* (
218 tmat2x2<T, P> const & m1,
219 tmat3x2<T, P> const & m2);
220
221 template <typename T, precision P>
222 GLM_FUNC_DECL tmat4x2<T, P> operator* (
223 tmat2x2<T, P> const & m1,
224 tmat4x2<T, P> const & m2);
225
226 template <typename T, precision P>
227 GLM_FUNC_DECL tmat2x2<T, P> operator/ (
228 tmat2x2<T, P> const & m,
229 T const & s);
230
231 template <typename T, precision P>
232 GLM_FUNC_DECL tmat2x2<T, P> operator/ (
233 T const & s,
234 tmat2x2<T, P> const & m);
235
236 template <typename T, precision P>
237 GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator/ (
238 tmat2x2<T, P> const & m,
239 typename tmat2x2<T, P>::row_type const & v);
240
241 template <typename T, precision P>
242 GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator/ (
243 typename tmat2x2<T, P>::col_type const & v,
244 tmat2x2<T, P> const & m);
245
246 template <typename T, precision P>
247 GLM_FUNC_DECL tmat2x2<T, P> operator/ (
248 tmat2x2<T, P> const & m1,
249 tmat2x2<T, P> const & m2);
250
251 // Unary constant operators
252 template <typename T, precision P>
253 GLM_FUNC_DECL tmat2x2<T, P> const operator-(
254 tmat2x2<T, P> const & m);
255 } //namespace detail
256 } //namespace glm
257
258 #ifndef GLM_EXTERNAL_TEMPLATE
259 #include "type_mat2x2.inl"
260 #endif
261
262 #endif //glm_core_type_mat2x2
glm::length
GLM_FUNC_DECL genType::value_type length(genType const &x)
Returns the length of x, i.e., sqrt(x * x).
glm::inverse
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)
Return the inverse of a squared matrix.