0.9.9 API documenation

- Main Page
- Modules
- Files

- File List

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