0.9.7: type_mat2x2.hpp Source File

| 0.9.7

- Main Page
- Modules
- Files

- File List

type_mat2x2.hpp
Go to the documentation of this file.
1
33 #pragma once
34
35 #include "../fwd.hpp"
36 #include "type_vec2.hpp"
37 #include "type_mat.hpp"
38 #include <limits>
39 #include <cstddef>
40
41 namespace glm
42 {
43 template <typename T, precision P = defaultp>
44 struct tmat2x2
45 {
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 typedef T value_type;
51
52 template <typename U, precision Q>
53 friend tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
54 template <typename U, precision Q>
55 friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);
56
57 # ifdef GLM_META_PROG_HELPERS
58 static GLM_RELAXED_CONSTEXPR length_t components = 2;
59 static GLM_RELAXED_CONSTEXPR length_t cols = 2;
60 static GLM_RELAXED_CONSTEXPR length_t rows = 2;
61 static GLM_RELAXED_CONSTEXPR precision prec = P;
62 # endif//GLM_META_PROG_HELPERS
63
64 private:
65 col_type value[2];
66
67 public:
68 // -- Constructors --
69
70 GLM_FUNC_DECL tmat2x2() GLM_DEFAULT_CTOR;
71 GLM_FUNC_DECL tmat2x2(tmat2x2<T, P> const & m) GLM_DEFAULT;
72 template <precision Q>
73 GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m);
74
75 GLM_FUNC_DECL explicit tmat2x2(ctor);
76 GLM_FUNC_DECL explicit tmat2x2(T const & x);
77 GLM_FUNC_DECL tmat2x2(
78 T const & x1, T const & y1,
79 T const & x2, T const & y2);
80 GLM_FUNC_DECL tmat2x2(
81 col_type const & v1,
82 col_type const & v2);
83
84 // -- Conversions --
85
86 template <typename U, typename V, typename M, typename N>
87 GLM_FUNC_DECL tmat2x2(
88 U const & x1, V const & y1,
89 M const & x2, N const & y2);
90
91 template <typename U, typename V>
92 GLM_FUNC_DECL tmat2x2(
93 tvec2<U, P> const & v1,
94 tvec2<V, P> const & v2);
95
96 // -- Matrix conversions --
97
98 template <typename U, precision Q>
99 GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x2<U, Q> const & m);
100
101 GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x);
102 GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x);
103 GLM_FUNC_DECL explicit tmat2x2(tmat2x3<T, P> const & x);
104 GLM_FUNC_DECL explicit tmat2x2(tmat3x2<T, P> const & x);
105 GLM_FUNC_DECL explicit tmat2x2(tmat2x4<T, P> const & x);
106 GLM_FUNC_DECL explicit tmat2x2(tmat4x2<T, P> const & x);
107 GLM_FUNC_DECL explicit tmat2x2(tmat3x4<T, P> const & x);
108 GLM_FUNC_DECL explicit tmat2x2(tmat4x3<T, P> const & x);
109
110 // -- Accesses --
111
112 # ifdef GLM_FORCE_SIZE_FUNC
113 typedef size_t size_type;
114 GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
115
116 GLM_FUNC_DECL col_type & operator[](size_type i);
117 GLM_FUNC_DECL col_type const & operator[](size_type i) const;
118 # else
119 typedef length_t length_type;
120 GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
121
122 GLM_FUNC_DECL col_type & operator[](length_type i);
123 GLM_FUNC_DECL col_type const & operator[](length_type i) const;
124 # endif//GLM_FORCE_SIZE_FUNC
125
126 // -- Unary arithmetic operators --
127
128 GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & v) GLM_DEFAULT;;
129
130 template <typename U>
131 GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<U, P> const & m);
132 template <typename U>
133 GLM_FUNC_DECL tmat2x2<T, P> & operator+=(U s);
134 template <typename U>
135 GLM_FUNC_DECL tmat2x2<T, P> & operator+=(tmat2x2<U, P> const & m);
136 template <typename U>
137 GLM_FUNC_DECL tmat2x2<T, P> & operator-=(U s);
138 template <typename U>
139 GLM_FUNC_DECL tmat2x2<T, P> & operator-=(tmat2x2<U, P> const & m);
140 template <typename U>
141 GLM_FUNC_DECL tmat2x2<T, P> & operator*=(U s);
142 template <typename U>
143 GLM_FUNC_DECL tmat2x2<T, P> & operator*=(tmat2x2<U, P> const & m);
144 template <typename U>
145 GLM_FUNC_DECL tmat2x2<T, P> & operator/=(U s);
146 template <typename U>
147 GLM_FUNC_DECL tmat2x2<T, P> & operator/=(tmat2x2<U, P> const & m);
148
149 // -- Increment and decrement operators --
150
151 GLM_FUNC_DECL tmat2x2<T, P> & operator++ ();
152 GLM_FUNC_DECL tmat2x2<T, P> & operator-- ();
153 GLM_FUNC_DECL tmat2x2<T, P> operator++(int);
154 GLM_FUNC_DECL tmat2x2<T, P> operator--(int);
155 };
156
157 // -- Unary operators --
158
159 template <typename T, precision P>
160 GLM_FUNC_DECL tmat2x2<T, P> const operator-(tmat2x2<T, P> const & m);
161
162 // -- Binary operators --
163
164 template <typename T, precision P>
165 GLM_FUNC_DECL tmat2x2<T, P> operator+(tmat2x2<T, P> const & m, T const & s);
166
167 template <typename T, precision P>
168 GLM_FUNC_DECL tmat2x2<T, P> operator+(T const & s, tmat2x2<T, P> const & m);
169
170 template <typename T, precision P>
171 GLM_FUNC_DECL tmat2x2<T, P> operator+(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
172
173 template <typename T, precision P>
174 GLM_FUNC_DECL tmat2x2<T, P> operator-(tmat2x2<T, P> const & m, T const & s);
175
176 template <typename T, precision P>
177 GLM_FUNC_DECL tmat2x2<T, P> operator-(T const & s, tmat2x2<T, P> const & m);
178
179 template <typename T, precision P>
180 GLM_FUNC_DECL tmat2x2<T, P> operator-(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
181
182 template <typename T, precision P>
183 GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat2x2<T, P> const & m, T const & s);
184
185 template <typename T, precision P>
186 GLM_FUNC_DECL tmat2x2<T, P> operator*(T const & s, tmat2x2<T, P> const & m);
187
188 template <typename T, precision P>
189 GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator*(tmat2x2<T, P> const & m, typename tmat2x2<T, P>::row_type const & v);
190
191 template <typename T, precision P>
192 GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator*(typename tmat2x2<T, P>::col_type const & v, tmat2x2<T, P> const & m);
193
194 template <typename T, precision P>
195 GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
196
197 template <typename T, precision P>
198 GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat3x2<T, P> const & m2);
199
200 template <typename T, precision P>
201 GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat4x2<T, P> const & m2);
202
203 template <typename T, precision P>
204 GLM_FUNC_DECL tmat2x2<T, P> operator/(tmat2x2<T, P> const & m, T const & s);
205
206 template <typename T, precision P>
207 GLM_FUNC_DECL tmat2x2<T, P> operator/(T const & s, tmat2x2<T, P> const & m);
208
209 template <typename T, precision P>
210 GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator/(tmat2x2<T, P> const & m, typename tmat2x2<T, P>::row_type const & v);
211
212 template <typename T, precision P>
213 GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator/(typename tmat2x2<T, P>::col_type const & v, tmat2x2<T, P> const & m);
214
215 template <typename T, precision P>
216 GLM_FUNC_DECL tmat2x2<T, P> operator/(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
217
218 // -- Boolean operators --
219
220 template <typename T, precision P>
221 GLM_FUNC_DECL bool operator==(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
222
223 template <typename T, precision P>
224 GLM_FUNC_DECL bool operator!=(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
225 } //namespace glm
226
227 #ifndef GLM_EXTERNAL_TEMPLATE
228 #include "type_mat2x2.inl"
229 #endif
glm::length
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
glm
Definition: _noise.hpp:40
type_vec2.hpp
OpenGL Mathematics (glm.g-truc.net)
type_mat.hpp
OpenGL Mathematics (glm.g-truc.net)