Qt 4.8
|
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows. More...
#include <qgenericmatrix.h>
Public Functions | |
const T * | constData () const |
Returns a constant pointer to the raw data of this matrix. More... | |
void | copyDataTo (T *values) const |
Retrieves the N * M items in this matrix and copies them to values in row-major order. More... | |
T * | data () |
Returns a pointer to the raw data of this matrix. More... | |
const T * | data () const |
Returns a constant pointer to the raw data of this matrix. More... | |
void | fill (T value) |
Fills all elements of this matrix with value. More... | |
bool | isIdentity () const |
Returns true if this matrix is the identity; false otherwise. More... | |
bool | operator!= (const QGenericMatrix< N, M, T > &other) const |
Returns true if this matrix is not identical to other; false otherwise. More... | |
const T & | operator() (int row, int column) const |
Returns a constant reference to the element at position (row, column) in this matrix. More... | |
T & | operator() (int row, int column) |
Returns a reference to the element at position (row, column) in this matrix so that the element can be assigned to. More... | |
QGenericMatrix< N, M, T > & | operator*= (T factor) |
Multiplies all elements of this matrix by factor. More... | |
QGenericMatrix< N, M, T > & | operator+= (const QGenericMatrix< N, M, T > &other) |
Adds the contents of other to this matrix. More... | |
QGenericMatrix< N, M, T > & | operator-= (const QGenericMatrix< N, M, T > &other) |
Subtracts the contents of other from this matrix. More... | |
QGenericMatrix< N, M, T > & | operator/= (T divisor) |
Divides all elements of this matrix by divisor. More... | |
bool | operator== (const QGenericMatrix< N, M, T > &other) const |
Returns true if this matrix is identical to other; false otherwise. More... | |
QGenericMatrix () | |
QGenericMatrix (const QGenericMatrix< N, M, T > &other) | |
Constructs a copy of other. More... | |
QGenericMatrix (const T *values) | |
Constructs a matrix from the given N * M floating-point values. More... | |
void | setToIdentity () |
Sets this matrix to the identity. More... | |
QGenericMatrix< M, N, T > | transposed () const |
Returns this matrix, transposed about its diagonal. More... | |
Private Functions | |
QGenericMatrix (int) | |
Properties | |
T | m [N][M] |
Friends | |
template<int NN, int M1, int M2, typename TT > | |
QGenericMatrix< M1, M2, TT > | operator* (const QGenericMatrix< NN, M2, TT > &m1, const QGenericMatrix< M1, NN, TT > &m2) |
template<int NN, int MM, typename TT > | |
QGenericMatrix< NN, MM, TT > | operator* (TT factor, const QGenericMatrix< NN, MM, TT > &matrix) |
template<int NN, int MM, typename TT > | |
QGenericMatrix< NN, MM, TT > | operator* (const QGenericMatrix< NN, MM, TT > &matrix, TT factor) |
template<int NN, int MM, typename TT > | |
QGenericMatrix< NN, MM, TT > | operator+ (const QGenericMatrix< NN, MM, TT > &m1, const QGenericMatrix< NN, MM, TT > &m2) |
template<int NN, int MM, typename TT > | |
QGenericMatrix< NN, MM, TT > | operator- (const QGenericMatrix< NN, MM, TT > &m1, const QGenericMatrix< NN, MM, TT > &m2) |
template<int NN, int MM, typename TT > | |
QGenericMatrix< NN, MM, TT > | operator- (const QGenericMatrix< NN, MM, TT > &matrix) |
template<int NN, int MM, typename TT > | |
QGenericMatrix< NN, MM, TT > | operator/ (const QGenericMatrix< NN, MM, TT > &matrix, TT divisor) |
template<int NN, int MM, typename TT > | |
class | QGenericMatrix |
Constructs a NxM identity matrix. More... | |
Related Functions | |
(Note that these are not member functions.) | |
QGenericMatrix< M1, M2, T > | operator* (const QGenericMatrix< N, M2, T > &m1, const QGenericMatrix< M1, N, T > &m2) |
QGenericMatrix< N, M, T > | operator* (T factor, const QGenericMatrix< N, M, T > &matrix) |
QGenericMatrix< N, M, T > | operator* (const QGenericMatrix< N, M, T > &matrix, T factor) |
QGenericMatrix< N, M, T > | operator+ (const QGenericMatrix< N, M, T > &m1, const QGenericMatrix< N, M, T > &m2) |
Returns the sum of m1 and m2. More... | |
QGenericMatrix< N, M, T > | operator- (const QGenericMatrix< N, M, T > &m1, const QGenericMatrix< N, M, T > &m2) |
Returns the difference of m1 and m2. More... | |
QGenericMatrix< N, M, T > | operator- (const QGenericMatrix< N, M, T > &matrix) |
Returns the negation of matrix. More... | |
QGenericMatrix< N, M, T > | operator/ (const QGenericMatrix< N, M, T > &matrix, T divisor) |
Returns the result of dividing all elements of matrix by divisor. More... | |
QDataStream & | operator<< (QDataStream &stream, const QGenericMatrix< N, M, T > &matrix) |
Writes the given matrix to the given stream and returns a reference to the stream. More... | |
QDataStream & | operator>> (QDataStream &stream, QGenericMatrix< N, M, T > &matrix) |
Reads a NxM matrix from the given stream into the given matrix and returns a reference to the stream. More... | |
QMatrix2x2 | |
The QMatrix2x2 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 2 rows, and qreal as the element type. More... | |
QMatrix2x3 | |
The QMatrix2x3 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 3 rows, and qreal as the element type. More... | |
QMatrix2x4 | |
The QMatrix2x4 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 4 rows, and qreal as the element type. More... | |
QMatrix3x2 | |
The QMatrix3x2 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 2 rows, and qreal as the element type. More... | |
QMatrix3x3 | |
The QMatrix3x3 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 3 rows, and qreal as the element type. More... | |
QMatrix3x4 | |
The QMatrix3x4 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 4 rows, and qreal as the element type. More... | |
QMatrix4x2 | |
The QMatrix4x2 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 2 rows, and qreal as the element type. More... | |
QMatrix4x3 | |
The QMatrix4x3 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 3 rows, and qreal as the element type. More... | |
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows.
The QGenericMatrix template has three parameters:
N | Number of columns. |
M | Number of rows. |
T | Element type that is visible to users of the class. |
Definition at line 56 of file qgenericmatrix.h.
Q_INLINE_TEMPLATE QGenericMatrix< N, M, T >::QGenericMatrix | ( | ) |
Definition at line 115 of file qgenericmatrix.h.
Q_INLINE_TEMPLATE QGenericMatrix< N, M, T >::QGenericMatrix | ( | const QGenericMatrix< N, M, T > & | other | ) |
|
explicit |
Constructs a matrix from the given N * M floating-point values.
The contents of the array values is assumed to be in row-major order.
Definition at line 129 of file qgenericmatrix.h.
|
inlineprivate |
Definition at line 106 of file qgenericmatrix.h.
|
inline |
Returns a constant pointer to the raw data of this matrix.
Definition at line 84 of file qgenericmatrix.h.
Referenced by qGenericMatrixToMatrix4x4(), and QMatrix4x4::QMatrix4x4().
Q_OUTOFLINE_TEMPLATE void QGenericMatrix< N, M, T >::copyDataTo | ( | T * | values | ) | const |
Retrieves the N * M items in this matrix and copies them to values in row-major order.
Definition at line 332 of file qgenericmatrix.h.
|
inline |
Returns a pointer to the raw data of this matrix.
Definition at line 82 of file qgenericmatrix.h.
Referenced by QMatrix4x4::normalMatrix(), qGenericMatrixFromMatrix4x4(), and QMatrix4x4::toGenericMatrix().
|
inline |
Returns a constant pointer to the raw data of this matrix.
Definition at line 83 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE void QGenericMatrix< N, M, T >::fill | ( | T | value | ) |
Fills all elements of this matrix with value.
Definition at line 181 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE bool QGenericMatrix< N, M, T >::isIdentity | ( | ) | const |
Returns true if this matrix is the identity; false otherwise.
Definition at line 151 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE bool QGenericMatrix< N, M, T >::operator!= | ( | const QGenericMatrix< N, M, T > & | other | ) | const |
Returns true if this matrix is not identical to other; false otherwise.
Definition at line 237 of file qgenericmatrix.h.
Q_INLINE_TEMPLATE const T & QGenericMatrix< N, M, T >::operator() | ( | int | row, |
int | column | ||
) | const |
Returns a constant reference to the element at position (row, column) in this matrix.
Definition at line 137 of file qgenericmatrix.h.
Q_INLINE_TEMPLATE T & QGenericMatrix< N, M, T >::operator() | ( | int | row, |
int | column | ||
) |
Returns a reference to the element at position (row, column) in this matrix so that the element can be assigned to.
Definition at line 144 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE QGenericMatrix< N, M, T > & QGenericMatrix< N, M, T >::operator*= | ( | T | factor | ) |
Multiplies all elements of this matrix by factor.
Definition at line 217 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE QGenericMatrix< N, M, T > & QGenericMatrix< N, M, T >::operator+= | ( | const QGenericMatrix< N, M, T > & | other | ) |
Adds the contents of other to this matrix.
Definition at line 199 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE QGenericMatrix< N, M, T > & QGenericMatrix< N, M, T >::operator-= | ( | const QGenericMatrix< N, M, T > & | other | ) |
Subtracts the contents of other from this matrix.
Definition at line 208 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE QGenericMatrix< N, M, T > & QGenericMatrix< N, M, T >::operator/= | ( | T | divisor | ) |
Divides all elements of this matrix by divisor.
Definition at line 248 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE bool QGenericMatrix< N, M, T >::operator== | ( | const QGenericMatrix< N, M, T > & | other | ) | const |
Returns true if this matrix is identical to other; false otherwise.
Definition at line 226 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE void QGenericMatrix< N, M, T >::setToIdentity | ( | ) |
Sets this matrix to the identity.
Definition at line 168 of file qgenericmatrix.h.
Referenced by QGenericMatrix< N, M, T >::QGenericMatrix().
Q_OUTOFLINE_TEMPLATE QGenericMatrix< M, N, T > QGenericMatrix< N, M, T >::transposed | ( | ) | const |
Returns this matrix, transposed about its diagonal.
Definition at line 189 of file qgenericmatrix.h.
|
friend |
Referenced by QGenericMatrix< N, M, T >::constData().
|
friend |
|
friend |
|
related |
Returns the product of the NxM2 matrix m1 and the M1xN matrix m2 to produce a M1xM2 matrix result.
Definition at line 277 of file qgenericmatrix.h.
|
related |
Returns the result of multiplying all elements of matrix by factor.
Definition at line 302 of file qgenericmatrix.h.
|
related |
Returns the result of multiplying all elements of matrix by factor.
Definition at line 312 of file qgenericmatrix.h.
|
friend |
Referenced by QGenericMatrix< N, M, T >::constData().
|
related |
Returns the sum of m1 and m2.
Definition at line 257 of file qgenericmatrix.h.
|
friend |
Referenced by QGenericMatrix< N, M, T >::constData().
|
friend |
|
related |
Returns the difference of m1 and m2.
Definition at line 267 of file qgenericmatrix.h.
|
related |
Returns the negation of matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 292 of file qgenericmatrix.h.
|
friend |
Referenced by QGenericMatrix< N, M, T >::constData().
|
related |
Returns the result of dividing all elements of matrix by divisor.
Definition at line 322 of file qgenericmatrix.h.
|
related |
Writes the given matrix to the given stream and returns a reference to the stream.
Definition at line 371 of file qgenericmatrix.h.
|
related |
Reads a NxM matrix from the given stream into the given matrix and returns a reference to the stream.
Definition at line 380 of file qgenericmatrix.h.
|
friend |
Constructs a NxM identity matrix.
Definition at line 110 of file qgenericmatrix.h.
|
related |
The QMatrix2x2 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 2 rows, and qreal as the element type.
|
related |
The QMatrix2x3 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 3 rows, and qreal as the element type.
|
related |
The QMatrix2x4 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 4 rows, and qreal as the element type.
|
related |
The QMatrix3x2 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 2 rows, and qreal as the element type.
|
related |
The QMatrix3x3 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 3 rows, and qreal as the element type.
|
related |
The QMatrix3x4 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 4 rows, and qreal as the element type.
|
related |
The QMatrix4x2 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 2 rows, and qreal as the element type.
|
related |
The QMatrix4x3 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 3 rows, and qreal as the element type.
|
private |
Definition at line 104 of file qgenericmatrix.h.
Referenced by QGenericMatrix< N, M, T >::constData(), QGenericMatrix< N, M, T >::copyDataTo(), QGenericMatrix< N, M, T >::data(), QGenericMatrix< N, M, T >::fill(), QGenericMatrix< N, M, T >::isIdentity(), QGenericMatrix< N, M, T >::operator!=(), QGenericMatrix< N, M, T >::operator()(), operator*(), QGenericMatrix< N, M, T >::operator*=(), operator+(), QGenericMatrix< N, M, T >::operator+=(), operator-(), QGenericMatrix< N, M, T >::operator-=(), operator/(), QGenericMatrix< N, M, T >::operator/=(), operator<<(), QGenericMatrix< N, M, T >::operator==(), QGenericMatrix< N, M, T >::QGenericMatrix(), QGenericMatrix< N, M, T >::setToIdentity(), and QGenericMatrix< N, M, T >::transposed().