Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qgenericmatrix.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qgenericmatrix.h"
6
7
QT_BEGIN_NAMESPACE
8
9
QT_IMPL_METATYPE_EXTERN(QMatrix2x2)
10
QT_IMPL_METATYPE_EXTERN(QMatrix2x3)
11
QT_IMPL_METATYPE_EXTERN(QMatrix2x4)
12
QT_IMPL_METATYPE_EXTERN(QMatrix3x2)
13
QT_IMPL_METATYPE_EXTERN(QMatrix3x3)
14
QT_IMPL_METATYPE_EXTERN(QMatrix3x4)
15
QT_IMPL_METATYPE_EXTERN(QMatrix4x2)
16
QT_IMPL_METATYPE_EXTERN(QMatrix4x3)
17
18
/*!
19
\class QGenericMatrix
20
\brief The QGenericMatrix class is a template class that represents an N x M transformation matrix with N columns and M rows.
21
\since 4.6
22
\ingroup painting
23
\ingroup painting-3D
24
\inmodule QtGui
25
26
QGenericMatrix<N, M, T> is a template class where \a N is the number of
27
columns, \a M is the number of rows, and \a T is the element type that is
28
visible to users of the class.
29
30
\sa QMatrix4x4
31
*/
32
33
/*!
34
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix()
35
36
Constructs an \a N x \a M identity matrix.
37
*/
38
39
/*!
40
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix(Qt::Initialization)
41
\since 5.5
42
\internal
43
44
Constructs an \a N x \a M matrix without initializing the contents.
45
*/
46
47
/*!
48
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix(const T *values)
49
50
Constructs a matrix from the given \a N * \a M floating-point \a values.
51
The contents of the array \a values is assumed to be in
52
row-major order.
53
54
\sa copyDataTo()
55
*/
56
57
/*!
58
\fn template <int N, int M, typename T> const T& QGenericMatrix<N, M, T>::operator()(int row, int column) const
59
60
Returns a constant reference to the element at position
61
(\a row, \a column) in this matrix.
62
*/
63
64
/*!
65
\fn template <int N, int M, typename T> T& QGenericMatrix<N, M, T>::operator()(int row, int column)
66
67
Returns a reference to the element at position (\a row, \a column)
68
in this matrix so that the element can be assigned to.
69
*/
70
71
/*!
72
\fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::isIdentity() const
73
74
Returns \c true if this matrix is the identity; false otherwise.
75
76
\sa setToIdentity()
77
*/
78
79
/*!
80
\fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::setToIdentity()
81
82
Sets this matrix to the identity.
83
84
\sa isIdentity()
85
*/
86
87
/*!
88
\fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::fill(T value)
89
90
Fills all elements of this matrix with \a value.
91
*/
92
93
/*!
94
\fn template <int N, int M, typename T> QGenericMatrix<M, N> QGenericMatrix<N, M, T>::transposed() const
95
96
Returns this matrix, transposed about its diagonal.
97
*/
98
99
/*!
100
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator+=(const QGenericMatrix<N, M, T>& other)
101
102
Adds the contents of \a other to this matrix.
103
*/
104
105
/*!
106
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator-=(const QGenericMatrix<N, M, T>& other)
107
108
Subtracts the contents of \a other from this matrix.
109
*/
110
111
/*!
112
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator*=(T factor)
113
114
Multiplies all elements of this matrix by \a factor.
115
*/
116
117
/*!
118
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/=(T divisor)
119
120
Divides all elements of this matrix by \a divisor.
121
*/
122
123
/*!
124
\fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::operator==(const QGenericMatrix<N, M, T>& other) const
125
126
Returns \c true if this matrix is identical to \a other; false otherwise.
127
*/
128
129
/*!
130
\fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::operator!=(const QGenericMatrix<N, M, T>& other) const
131
132
Returns \c true if this matrix is not identical to \a other; false otherwise.
133
*/
134
135
/*!
136
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
137
\relates QGenericMatrix
138
139
Returns the sum of the \a N x \a M matrices \a m1 and \a m2.
140
*/
141
142
/*!
143
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
144
\relates QGenericMatrix
145
146
Returns the difference of the \a N x \a M matrices \a m1 and \a m2.
147
*/
148
149
/*!
150
\fn template <int N, int M, typename T> template<int NN, int M1, int M2, typename TT> QGenericMatrix<M1, M2, TT> QGenericMatrix<N, M, T>::operator*(const QGenericMatrix<NN, M2, TT>& m1, const QGenericMatrix<M1, NN, TT>& m2)
151
152
Returns the product of the \a NN x \a M2 matrix \a m1 and the \a M1 x \a NN
153
matrix \a m2 to produce an \a M1 x \a M2 matrix result.
154
*/
155
156
/*!
157
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix)
158
\overload
159
\relates QGenericMatrix
160
161
Returns the negation of \a matrix.
162
*/
163
164
/*!
165
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix)
166
\relates QGenericMatrix
167
168
Returns the result of multiplying all elements of the \a N x \a M
169
\a matrix by \a factor.
170
*/
171
172
/*!
173
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor)
174
\relates QGenericMatrix
175
176
Returns the result of multiplying all elements of \a matrix by \a factor.
177
*/
178
179
/*!
180
\fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor)
181
\relates QGenericMatrix
182
183
Returns the result of dividing all elements of the \a N x \a M
184
\a matrix by \a divisor.
185
*/
186
187
/*!
188
\fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::copyDataTo(T *values) const
189
190
Retrieves the \a N * \a M items in this matrix and copies them to \a values
191
in row-major order.
192
*/
193
194
/*!
195
\fn template <int N, int M, typename T> T *QGenericMatrix<N, M, T>::data()
196
197
Returns a pointer to the raw data of this matrix.
198
199
\sa constData()
200
*/
201
202
/*!
203
\fn template <int N, int M, typename T> const T *QGenericMatrix<N, M, T>::data() const
204
205
Returns a constant pointer to the raw data of this matrix.
206
207
\sa constData()
208
*/
209
210
/*!
211
\fn template <int N, int M, typename T> const T *QGenericMatrix<N, M, T>::constData() const
212
213
Returns a constant pointer to the raw data of this matrix.
214
215
\sa data()
216
*/
217
218
#
ifndef
QT_NO_DATASTREAM
219
220
/*!
221
\fn template <int N, int M, typename T> QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix)
222
\relates QGenericMatrix
223
224
Writes the given \a N x \a M \a matrix to the given \a stream and returns a
225
reference to the stream.
226
227
\sa {Serializing Qt Data Types}
228
*/
229
230
/*!
231
\fn template <int N, int M, typename T> QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix)
232
\relates QGenericMatrix
233
234
Reads an \a N x \a M matrix from the given \a stream into the given \a matrix
235
and returns a reference to the stream.
236
237
\sa {Serializing Qt Data Types}
238
*/
239
240
#
endif
241
242
/*!
243
\typedef QMatrix2x2
244
\relates QGenericMatrix
245
246
The QMatrix2x2 type defines a convenient instantiation of the
247
QGenericMatrix template for 2 columns, 2 rows, and float as
248
the element type.
249
*/
250
251
/*!
252
\typedef QMatrix2x3
253
\relates QGenericMatrix
254
255
The QMatrix2x3 type defines a convenient instantiation of the
256
QGenericMatrix template for 2 columns, 3 rows, and float as
257
the element type.
258
*/
259
260
/*!
261
\typedef QMatrix2x4
262
\relates QGenericMatrix
263
264
The QMatrix2x4 type defines a convenient instantiation of the
265
QGenericMatrix template for 2 columns, 4 rows, and float as
266
the element type.
267
*/
268
269
/*!
270
\typedef QMatrix3x2
271
\relates QGenericMatrix
272
273
The QMatrix3x2 type defines a convenient instantiation of the
274
QGenericMatrix template for 3 columns, 2 rows, and float as
275
the element type.
276
*/
277
278
/*!
279
\typedef QMatrix3x3
280
\relates QGenericMatrix
281
282
The QMatrix3x3 type defines a convenient instantiation of the
283
QGenericMatrix template for 3 columns, 3 rows, and float as
284
the element type.
285
*/
286
287
/*!
288
\typedef QMatrix3x4
289
\relates QGenericMatrix
290
291
The QMatrix3x4 type defines a convenient instantiation of the
292
QGenericMatrix template for 3 columns, 4 rows, and float as
293
the element type.
294
*/
295
296
/*!
297
\typedef QMatrix4x2
298
\relates QGenericMatrix
299
300
The QMatrix4x2 type defines a convenient instantiation of the
301
QGenericMatrix template for 4 columns, 2 rows, and float as
302
the element type.
303
*/
304
305
/*!
306
\typedef QMatrix4x3
307
\relates QGenericMatrix
308
309
The QMatrix4x3 type defines a convenient instantiation of the
310
QGenericMatrix template for 4 columns, 3 rows, and float as
311
the element type.
312
*/
313
314
QT_END_NAMESPACE
qtbase
src
gui
math3d
qgenericmatrix.cpp
Generated on
for Qt by
1.18.0