Changeset 846 for trunk/src/gui/math3d/qgenericmatrix.h
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/math3d/qgenericmatrix.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 199 199 Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator+=(const QGenericMatrix<N, M, T>& other) 200 200 { 201 for (int index = 0; index < N * M; ++index) 202 m[0][index] += other.m[0][index]; 201 for (int row = 0; row < M; ++row) 202 for (int col = 0; col < N; ++col) 203 m[col][row] += other.m[col][row]; 203 204 return *this; 204 205 } … … 207 208 Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator-=(const QGenericMatrix<N, M, T>& other) 208 209 { 209 for (int index = 0; index < N * M; ++index) 210 m[0][index] -= other.m[0][index]; 210 for (int row = 0; row < M; ++row) 211 for (int col = 0; col < N; ++col) 212 m[col][row] -= other.m[col][row]; 211 213 return *this; 212 214 } … … 215 217 Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator*=(T factor) 216 218 { 217 for (int index = 0; index < N * M; ++index) 218 m[0][index] *= factor; 219 for (int row = 0; row < M; ++row) 220 for (int col = 0; col < N; ++col) 221 m[col][row] *= factor; 219 222 return *this; 220 223 } … … 223 226 Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator==(const QGenericMatrix<N, M, T>& other) const 224 227 { 225 for (int index = 0; index < N * M; ++index) { 226 if (m[0][index] != other.m[0][index]) 227 return false; 228 } 228 for (int row = 0; row < M; ++row) 229 for (int col = 0; col < N; ++col) { 230 if (m[col][row] != other.m[col][row]) 231 return false; 232 } 229 233 return true; 230 234 } … … 233 237 Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator!=(const QGenericMatrix<N, M, T>& other) const 234 238 { 235 for (int index = 0; index < N * M; ++index) { 236 if (m[0][index] != other.m[0][index]) 237 return true; 238 } 239 for (int row = 0; row < M; ++row) 240 for (int col = 0; col < N; ++col) { 241 if (m[col][row] != other.m[col][row]) 242 return true; 243 } 239 244 return false; 240 245 } … … 243 248 Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/=(T divisor) 244 249 { 245 for (int index = 0; index < N * M; ++index) 246 m[0][index] /= divisor; 250 for (int row = 0; row < M; ++row) 251 for (int col = 0; col < N; ++col) 252 m[col][row] /= divisor; 247 253 return *this; 248 254 } … … 252 258 { 253 259 QGenericMatrix<N, M, T> result(1); 254 for (int index = 0; index < N * M; ++index) 255 result.m[0][index] = m1.m[0][index] + m2.m[0][index]; 260 for (int row = 0; row < M; ++row) 261 for (int col = 0; col < N; ++col) 262 result.m[col][row] = m1.m[col][row] + m2.m[col][row]; 256 263 return result; 257 264 } … … 261 268 { 262 269 QGenericMatrix<N, M, T> result(1); 263 for (int index = 0; index < N * M; ++index) 264 result.m[0][index] = m1.m[0][index] - m2.m[0][index]; 270 for (int row = 0; row < M; ++row) 271 for (int col = 0; col < N; ++col) 272 result.m[col][row] = m1.m[col][row] - m2.m[col][row]; 265 273 return result; 266 274 } … … 285 293 { 286 294 QGenericMatrix<N, M, T> result(1); 287 for (int index = 0; index < N * M; ++index) 288 result.m[0][index] = -matrix.m[0][index]; 295 for (int row = 0; row < M; ++row) 296 for (int col = 0; col < N; ++col) 297 result.m[col][row] = -matrix.m[col][row]; 289 298 return result; 290 299 } … … 294 303 { 295 304 QGenericMatrix<N, M, T> result(1); 296 for (int index = 0; index < N * M; ++index) 297 result.m[0][index] = matrix.m[0][index] * factor; 305 for (int row = 0; row < M; ++row) 306 for (int col = 0; col < N; ++col) 307 result.m[col][row] = matrix.m[col][row] * factor; 298 308 return result; 299 309 } … … 303 313 { 304 314 QGenericMatrix<N, M, T> result(1); 305 for (int index = 0; index < N * M; ++index) 306 result.m[0][index] = matrix.m[0][index] * factor; 315 for (int row = 0; row < M; ++row) 316 for (int col = 0; col < N; ++col) 317 result.m[col][row] = matrix.m[col][row] * factor; 307 318 return result; 308 319 } … … 312 323 { 313 324 QGenericMatrix<N, M, T> result(1); 314 for (int index = 0; index < N * M; ++index) 315 result.m[0][index] = matrix.m[0][index] / divisor; 325 for (int row = 0; row < M; ++row) 326 for (int col = 0; col < N; ++col) 327 result.m[col][row] = matrix.m[col][row] / divisor; 316 328 return result; 317 329 }
Note:
See TracChangeset
for help on using the changeset viewer.