|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtGui module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qgenericmatrix.h" |
|
43 |
|
44 QT_BEGIN_NAMESPACE |
|
45 |
|
46 /*! |
|
47 \class QGenericMatrix |
|
48 \brief The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows. |
|
49 \since 4.6 |
|
50 \ingroup painting |
|
51 \ingroup painting-3D |
|
52 |
|
53 The QGenericMatrix template has three parameters: |
|
54 |
|
55 \table |
|
56 \row \i N \i Number of columns. |
|
57 \row \i M \i Number of rows. |
|
58 \row \i T \i Element type that is visible to users of the class. |
|
59 \endtable |
|
60 |
|
61 \sa QMatrix4x4 |
|
62 */ |
|
63 |
|
64 /*! |
|
65 \fn QGenericMatrix::QGenericMatrix() |
|
66 |
|
67 Constructs a NxM identity matrix. |
|
68 */ |
|
69 |
|
70 /*! |
|
71 \fn QGenericMatrix::QGenericMatrix(const QGenericMatrix<N, M, T>& other) |
|
72 |
|
73 Constructs a copy of \a other. |
|
74 */ |
|
75 |
|
76 /*! |
|
77 \fn QGenericMatrix::QGenericMatrix(const T *values) |
|
78 |
|
79 Constructs a matrix from the given N * M floating-point \a values. |
|
80 The contents of the array \a values is assumed to be in |
|
81 row-major order. |
|
82 |
|
83 \sa toValueArray() |
|
84 */ |
|
85 |
|
86 /*! |
|
87 \fn const T& QGenericMatrix::operator()(int row, int column) const |
|
88 |
|
89 Returns a constant reference to the element at position |
|
90 (\a row, \a column) in this matrix. |
|
91 */ |
|
92 |
|
93 /*! |
|
94 \fn T& QGenericMatrix::operator()(int row, int column) |
|
95 |
|
96 Returns a reference to the element at position (\a row, \a column) |
|
97 in this matrix so that the element can be assigned to. |
|
98 */ |
|
99 |
|
100 /*! |
|
101 \fn bool QGenericMatrix::isIdentity() const |
|
102 |
|
103 Returns true if this matrix is the identity; false otherwise. |
|
104 |
|
105 \sa setIdentity() |
|
106 */ |
|
107 |
|
108 /*! |
|
109 \fn void QGenericMatrix::setIdentity() |
|
110 |
|
111 Sets this matrix to the identity. |
|
112 |
|
113 \sa isIdentity() |
|
114 */ |
|
115 |
|
116 /*! |
|
117 \fn void QGenericMatrix::fill(T value) |
|
118 |
|
119 Fills all elements of this matrix with \a value. |
|
120 */ |
|
121 |
|
122 /*! |
|
123 \fn QGenericMatrix<M, N> QGenericMatrix::transposed() const |
|
124 |
|
125 Returns this matrix, transposed about its diagonal. |
|
126 */ |
|
127 |
|
128 /*! |
|
129 \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator+=(const QGenericMatrix<N, M, T>& other) |
|
130 |
|
131 Adds the contents of \a other to this matrix. |
|
132 */ |
|
133 |
|
134 /*! |
|
135 \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator-=(const QGenericMatrix<N, M, T>& other) |
|
136 |
|
137 Subtracts the contents of \a other from this matrix. |
|
138 */ |
|
139 |
|
140 /*! |
|
141 \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator*=(T factor) |
|
142 |
|
143 Multiplies all elements of this matrix by \a factor. |
|
144 */ |
|
145 |
|
146 /*! |
|
147 \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator/=(T divisor) |
|
148 |
|
149 Divides all elements of this matrix by \a divisor. |
|
150 */ |
|
151 |
|
152 /*! |
|
153 \fn bool QGenericMatrix::operator==(const QGenericMatrix<N, M, T>& other) const |
|
154 |
|
155 Returns true if this matrix is identical to \a other; false otherwise. |
|
156 */ |
|
157 |
|
158 /*! |
|
159 \fn bool QGenericMatrix::operator!=(const QGenericMatrix<N, M, T>& other) const |
|
160 |
|
161 Returns true if this matrix is not identical to \a other; false otherwise. |
|
162 */ |
|
163 |
|
164 /*! |
|
165 \fn QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) |
|
166 \relates QGenericMatrix |
|
167 |
|
168 Returns the sum of \a m1 and \a m2. |
|
169 */ |
|
170 |
|
171 /*! |
|
172 \fn QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) |
|
173 \relates QGenericMatrix |
|
174 |
|
175 Returns the difference of \a m1 and \a m2. |
|
176 */ |
|
177 |
|
178 /*! |
|
179 \fn QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, M2, T>& m1, const QGenericMatrix<M1, N, T>& m2) |
|
180 \relates QGenericMatrix |
|
181 |
|
182 Returns the product of the NxM2 matrix \a m1 and the M1xN matrix \a m2 |
|
183 to produce a M1xM2 matrix result. |
|
184 */ |
|
185 |
|
186 /*! |
|
187 \fn QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix) |
|
188 \overload |
|
189 \relates QGenericMatrix |
|
190 |
|
191 Returns the negation of \a matrix. |
|
192 */ |
|
193 |
|
194 /*! |
|
195 \fn QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix) |
|
196 \relates QGenericMatrix |
|
197 |
|
198 Returns the result of multiplying all elements of \a matrix by \a factor. |
|
199 */ |
|
200 |
|
201 /*! |
|
202 \fn QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor) |
|
203 \relates QGenericMatrix |
|
204 |
|
205 Returns the result of multiplying all elements of \a matrix by \a factor. |
|
206 */ |
|
207 |
|
208 /*! |
|
209 \fn QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor) |
|
210 \relates QGenericMatrix |
|
211 |
|
212 Returns the result of dividing all elements of \a matrix by \a divisor. |
|
213 */ |
|
214 |
|
215 /*! |
|
216 \fn void QGenericMatrix::toValueArray(T *values) |
|
217 |
|
218 Retrieves the N * M items in this matrix and writes them to \a values |
|
219 in row-major order. |
|
220 */ |
|
221 |
|
222 /*! |
|
223 \fn T *QGenericMatrix::data() |
|
224 |
|
225 Returns a pointer to the raw data of this matrix. |
|
226 |
|
227 \sa constData() |
|
228 */ |
|
229 |
|
230 /*! |
|
231 \fn const T *QGenericMatrix::data() const |
|
232 |
|
233 Returns a constant pointer to the raw data of this matrix. |
|
234 |
|
235 \sa constData() |
|
236 */ |
|
237 |
|
238 /*! |
|
239 \fn const T *QGenericMatrix::constData() const |
|
240 |
|
241 Returns a constant pointer to the raw data of this matrix. |
|
242 |
|
243 \sa data() |
|
244 */ |
|
245 |
|
246 QT_END_NAMESPACE |