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 tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
55 template <typename U, precision Q>
56 friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);
57
58 private:
60 col_type value[2];
62
63 public:
65 // Constructors
66 GLM_FUNC_DECL tmat2x2();
67 GLM_FUNC_DECL tmat2x2(tmat2x2<T, P> const & m);
68 template <precision Q>
69 GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m);
70
71 GLM_FUNC_DECL explicit tmat2x2(
72 ctor Null);
73 GLM_FUNC_DECL explicit tmat2x2(
74 T const & x);
75 GLM_FUNC_DECL explicit tmat2x2(
76 T const & x1, T const & y1,
77 T const & x2, T const & y2);
78 GLM_FUNC_DECL explicit tmat2x2(
79 col_type const & v1,
80 col_type const & v2);
81
82 #if(GLM_HAS_INITIALIZER_LISTS)
83 template <typename U>
84 GLM_FUNC_DECL tmat2x2(std::initializer_list<U> m);
85
86 GLM_FUNC_DECL tmat2x2(std::initializer_list<tvec2<T, P> > m);
87 #endif//GLM_HAS_INITIALIZER_LISTS
88
90 // Conversions
91 template <typename U, typename V, typename M, typename N>
92 GLM_FUNC_DECL explicit tmat2x2(
93 U const & x1, V const & y1,
94 M const & x2, N const & y2);
95
96 template <typename U, typename V>
97 GLM_FUNC_DECL explicit tmat2x2(
98 tvec2<U, P> const & v1,
99 tvec2<V, P> const & v2);
100
102 // Matrix conversions
103 template <typename U, precision Q>
104 GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U, Q> const & m);
105
106 GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x);
107 GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x);
108 GLM_FUNC_DECL explicit tmat2x2(tmat2x3<T, P> const & x);
109 GLM_FUNC_DECL explicit tmat2x2(tmat3x2<T, P> const & x);
110 GLM_FUNC_DECL explicit tmat2x2(tmat2x4<T, P> const & x);
111 GLM_FUNC_DECL explicit tmat2x2(tmat4x2<T, P> const & x);
112 GLM_FUNC_DECL explicit tmat2x2(tmat3x4<T, P> const & x);
113 GLM_FUNC_DECL explicit tmat2x2(tmat4x3<T, P> const & x);
114
116 // Accesses
117
118 GLM_FUNC_DECL col_type & operator[](length_t i);
119 GLM_FUNC_DECL col_type const & operator[](length_t i) const;
120
121 // Unary updatable operators
122 GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & m);
123 template <typename U>
124 GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<U, P> const & m);
125 template <typename U>
126 GLM_FUNC_DECL tmat2x2<T, P> & operator+=(U s);
127 template <typename U>
128 GLM_FUNC_DECL tmat2x2<T, P> & operator+=(tmat2x2<U, P> const & m);
129 template <typename U>
130 GLM_FUNC_DECL tmat2x2<T, P> & operator-=(U s);
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
143 // Increment and decrement operators
144
145 GLM_FUNC_DECL tmat2x2<T, P> & operator++ ();
146 GLM_FUNC_DECL tmat2x2<T, P> & operator-- ();
147 GLM_FUNC_DECL tmat2x2<T, P> operator++(int);
148 GLM_FUNC_DECL tmat2x2<T, P> operator--(int);
149 };
150
151 template <typename T, precision P>
152 GLM_FUNC_DECL tmat2x2<T, P> compute_inverse_mat2(tmat2x2<T, P> const & m);
153
154 // Binary operators
155 template <typename T, precision P>
156 GLM_FUNC_DECL tmat2x2<T, P> operator+ (
157 tmat2x2<T, P> const & m,
158 T const & s);
159
160 template <typename T, precision P>
161 GLM_FUNC_DECL tmat2x2<T, P> operator+ (
162 T const & s,
163 tmat2x2<T, P> const & m);
164
165 template <typename T, precision P>
166 GLM_FUNC_DECL tmat2x2<T, P> operator+ (
167 tmat2x2<T, P> const & m1,
168 tmat2x2<T, P> const & m2);
169
170 template <typename T, precision P>
171 GLM_FUNC_DECL tmat2x2<T, P> operator- (
172 tmat2x2<T, P> const & m,
173 T const & s);
174
175 template <typename T, precision P>
176 GLM_FUNC_DECL tmat2x2<T, P> operator- (
177 T const & s,
178 tmat2x2<T, P> const & m);
179
180 template <typename T, precision P>
181 GLM_FUNC_DECL tmat2x2<T, P> operator- (
182 tmat2x2<T, P> const & m1,
183 tmat2x2<T, P> const & m2);
184
185 template <typename T, precision P>
186 GLM_FUNC_DECL tmat2x2<T, P> operator* (
187 tmat2x2<T, P> const & m,
188 T const & s);
189
190 template <typename T, precision P>
191 GLM_FUNC_DECL tmat2x2<T, P> operator* (
192 T const & s,
193 tmat2x2<T, P> const & m);
194
195 template <typename T, precision P>
196 GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator* (
197 tmat2x2<T, P> const & m,
198 typename tmat2x2<T, P>::row_type const & v);
199
200 template <typename T, precision P>
201 GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator* (
202 typename tmat2x2<T, P>::col_type const & v,
203 tmat2x2<T, P> const & m);
204
205 template <typename T, precision P>
206 GLM_FUNC_DECL tmat2x2<T, P> operator* (
207 tmat2x2<T, P> const & m1,
208 tmat2x2<T, P> const & m2);
209
210 template <typename T, precision P>
211 GLM_FUNC_DECL tmat3x2<T, P> operator* (
212 tmat2x2<T, P> const & m1,
213 tmat3x2<T, P> const & m2);
214
215 template <typename T, precision P>
216 GLM_FUNC_DECL tmat4x2<T, P> operator* (
217 tmat2x2<T, P> const & m1,
218 tmat4x2<T, P> const & m2);
219
220 template <typename T, precision P>
221 GLM_FUNC_DECL tmat2x2<T, P> operator/ (
222 tmat2x2<T, P> const & m,
223 T const & s);
224
225 template <typename T, precision P>
226 GLM_FUNC_DECL tmat2x2<T, P> operator/ (
227 T const & s,
228 tmat2x2<T, P> const & m);
229
230 template <typename T, precision P>
231 GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator/ (
232 tmat2x2<T, P> const & m,
233 typename tmat2x2<T, P>::row_type const & v);
234
235 template <typename T, precision P>
236 GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator/ (
237 typename tmat2x2<T, P>::col_type const & v,
238 tmat2x2<T, P> const & m);
239
240 template <typename T, precision P>
241 GLM_FUNC_DECL tmat2x2<T, P> operator/ (
242 tmat2x2<T, P> const & m1,
243 tmat2x2<T, P> const & m2);
244
245 // Unary constant operators
246 template <typename T, precision P>
247 GLM_FUNC_DECL tmat2x2<T, P> const operator-(
248 tmat2x2<T, P> const & m);
249 } //namespace detail
250 } //namespace glm
251
252 #ifndef GLM_EXTERNAL_TEMPLATE
253 #include "type_mat2x2.inl"
254 #endif
255
256 #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).