0.9.9 API documenation: type_mat2x2.hpp Source File

| 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 Q>
15 struct mat<2, 2, T, Q>
16 {
17 typedef vec<2, T, Q> col_type;
18 typedef vec<2, T, Q> row_type;
19 typedef mat<2, 2, T, Q> type;
20 typedef mat<2, 2, T, Q> 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 GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
38 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 2, T, Q> const& m) GLM_DEFAULT;
39 template<qualifier P>
40 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 2, T, P> const& m);
41
42 GLM_FUNC_DECL explicit GLM_CONSTEXPR_CTOR_CXX14 mat(T scalar);
43 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(
44 T const& x1, T const& y1,
45 T const& x2, T const& y2);
46 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 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 GLM_CONSTEXPR_CTOR_CXX14 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 GLM_CONSTEXPR_CTOR_CXX14 mat(
59 vec<2, U, Q> const& v1,
60 vec<2, V, Q> const& v2);
61
62 // -- Matrix conversions --
63
64 template<typename U, qualifier P>
65 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 2, U, P> const& m);
66
67 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 3, T, Q> const& x);
68 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 4, T, Q> const& x);
69 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 3, T, Q> const& x);
70 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 2, T, Q> const& x);
71 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 4, T, Q> const& x);
72 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 2, T, Q> const& x);
73 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 4, T, Q> const& x);
74 GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 3, T, Q> const& x);
75
76 // -- Unary arithmetic operators --
77
78 GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 mat<2, 2, T, Q> & operator=(mat<2, 2, T, Q> const& v) GLM_DEFAULT;
79
80 template<typename U>
81 GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 mat<2, 2, T, Q> & operator=(mat<2, 2, U, Q> const& m);
82 template<typename U>
83 GLM_FUNC_DECL mat<2, 2, T, Q> & operator+=(U s);
84 template<typename U>
85 GLM_FUNC_DECL mat<2, 2, T, Q> & operator+=(mat<2, 2, U, Q> const& m);
86 template<typename U>
87 GLM_FUNC_DECL mat<2, 2, T, Q> & operator-=(U s);
88 template<typename U>
89 GLM_FUNC_DECL mat<2, 2, T, Q> & operator-=(mat<2, 2, U, Q> const& m);
90 template<typename U>
91 GLM_FUNC_DECL mat<2, 2, T, Q> & operator*=(U s);
92 template<typename U>
93 GLM_FUNC_DECL mat<2, 2, T, Q> & operator*=(mat<2, 2, U, Q> const& m);
94 template<typename U>
95 GLM_FUNC_DECL mat<2, 2, T, Q> & operator/=(U s);
96 template<typename U>
97 GLM_FUNC_DECL mat<2, 2, T, Q> & operator/=(mat<2, 2, U, Q> const& m);
98
99 // -- Increment and decrement operators --
100
101 GLM_FUNC_DECL mat<2, 2, T, Q> & operator++ ();
102 GLM_FUNC_DECL mat<2, 2, T, Q> & operator-- ();
103 GLM_FUNC_DECL mat<2, 2, T, Q> operator++(int);
104 GLM_FUNC_DECL mat<2, 2, T, Q> operator--(int);
105 };
106
107 // -- Unary operators --
108
109 template<typename T, qualifier Q>
110 GLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m);
111
112 template<typename T, qualifier Q>
113 GLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m);
114
115 // -- Binary operators --
116
117 template<typename T, qualifier Q>
118 GLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m, T scalar);
119
120 template<typename T, qualifier Q>
121 GLM_FUNC_DECL mat<2, 2, T, Q> operator+(T scalar, mat<2, 2, T, Q> const& m);
122
123 template<typename T, qualifier Q>
124 GLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
125
126 template<typename T, qualifier Q>
127 GLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m, T scalar);
128
129 template<typename T, qualifier Q>
130 GLM_FUNC_DECL mat<2, 2, T, Q> operator-(T scalar, mat<2, 2, T, Q> const& m);
131
132 template<typename T, qualifier Q>
133 GLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
134
135 template<typename T, qualifier Q>
136 GLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m, T scalar);
137
138 template<typename T, qualifier Q>
139 GLM_FUNC_DECL mat<2, 2, T, Q> operator*(T scalar, mat<2, 2, T, Q> const& m);
140
141 template<typename T, qualifier Q>
142 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);
143
144 template<typename T, qualifier Q>
145 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);
146
147 template<typename T, qualifier Q>
148 GLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
149
150 template<typename T, qualifier Q>
151 GLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
152
153 template<typename T, qualifier Q>
154 GLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
155
156 template<typename T, qualifier Q>
157 GLM_FUNC_DECL mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m, T scalar);
158
159 template<typename T, qualifier Q>
160 GLM_FUNC_DECL mat<2, 2, T, Q> operator/(T scalar, mat<2, 2, T, Q> const& m);
161
162 template<typename T, qualifier Q>
163 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);
164
165 template<typename T, qualifier Q>
166 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);
167
168 template<typename T, qualifier Q>
169 GLM_FUNC_DECL mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
170
171 // -- Boolean operators --
172
173 template<typename T, qualifier Q>
174 GLM_FUNC_DECL bool operator==(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
175
176 template<typename T, qualifier Q>
177 GLM_FUNC_DECL bool operator!=(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
178 } //namespace glm
179
180 #ifndef GLM_EXTERNAL_TEMPLATE
181 #include "type_mat2x2.inl"
182 #endif
type_vec2.hpp
Core features
glm
Definition: common.hpp:20
glm::length
GLM_FUNC_DECL T length(vec< L, T, Q > const &x)
Returns the length of x, i.e., sqrt(x * x).
type_mat.hpp
Core features