![]() |
Qt 6.x
The Qt SDK
|
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows. More...
#include <qgenericmatrix.h>
Public Member Functions | |
QGenericMatrix () | |
QGenericMatrix (Qt::Initialization) | |
QGenericMatrix (const T *values) | |
Constructs a matrix from the given N * M floating-point values. | |
const T & | operator() (int row, int column) const |
Returns a constant reference to the element at position (row, column) in this matrix. | |
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. | |
bool | isIdentity () const |
Returns true if this matrix is the identity; false otherwise. | |
void | setToIdentity () |
Sets this matrix to the identity. | |
void | fill (T value) |
Fills all elements of this matrix with value. | |
QGenericMatrix< M, N, T > | transposed () const |
Returns this matrix, transposed about its diagonal. | |
QGenericMatrix< N, M, T > & | operator+= (const QGenericMatrix< N, M, T > &other) |
Adds the contents of other to this matrix. | |
QGenericMatrix< N, M, T > & | operator-= (const QGenericMatrix< N, M, T > &other) |
Subtracts the contents of other from this matrix. | |
QGenericMatrix< N, M, T > & | operator*= (T factor) |
Multiplies all elements of this matrix by factor. | |
QGenericMatrix< N, M, T > & | operator/= (T divisor) |
Divides all elements of this matrix by divisor. | |
bool | operator== (const QGenericMatrix< N, M, T > &other) const |
Returns true if this matrix is identical to other; false otherwise. | |
bool | operator!= (const QGenericMatrix< N, M, T > &other) const |
Returns true if this matrix is not identical to other; false otherwise. | |
void | copyDataTo (T *values) const |
Retrieves the N * M items in this matrix and copies them to values in row-major order. | |
T * | data () |
Returns a pointer to the raw data of this matrix. | |
const T * | data () const |
Returns a constant pointer to the raw data of this matrix. | |
const T * | constData () const |
Returns a constant pointer to the raw data of this matrix. | |
Friends | |
template<int NN, int MM, typename TT > | |
class | QGenericMatrix |
Constructs a NxM identity matrix. | |
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 M1, int M2, typename TT > | |
QGenericMatrix< M1, M2, TT > | operator* (const QGenericMatrix< NN, M2, TT > &m1, const QGenericMatrix< M1, NN, TT > &m2) |
Returns the product of the NNxM2 matrix m1 and the M1xNN matrix m2 to produce a M1xM2 matrix result. | |
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* (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 > &matrix, TT divisor) |
Related Symbols | |
(Note that these are not member symbols.) | |
template< int N, int M, typename T > QGenericMatrix< N, M, T > | operator+ (const QGenericMatrix< N, M, T > &m1, const QGenericMatrix< N, M, T > &m2) |
Returns the sum of m1 and m2. | |
template< int N, int M, typename T > QGenericMatrix< N, M, T > | operator- (const QGenericMatrix< N, M, T > &m1, const QGenericMatrix< N, M, T > &m2) |
Returns the difference of m1 and m2. | |
template< int N, int M, typename T > QGenericMatrix< N, M, T > | operator- (const QGenericMatrix< N, M, T > &matrix) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template< int N, int M, typename T > QGenericMatrix< N, M, T > | operator* (T factor, const QGenericMatrix< N, M, T > &matrix) |
Returns the result of multiplying all elements of matrix by factor. | |
template< int N, int M, typename T > QGenericMatrix< N, M, T > | operator* (const QGenericMatrix< N, M, T > &matrix, T factor) |
Returns the result of multiplying all elements of matrix by factor. | |
template< int N, int M, typename T > QGenericMatrix< N, M, T > | operator/ (const QGenericMatrix< N, M, T > &matrix, T divisor) |
Returns the result of dividing all elements of matrix by divisor. | |
template< int N, int M, typename T > 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. | |
template< int N, int M, typename T > 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. | |
QMatrix2x2 | |
The QMatrix2x2 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 2 rows, and float as the element type. | |
QMatrix2x3 | |
The QMatrix2x3 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 3 rows, and float as the element type. | |
QMatrix2x4 | |
The QMatrix2x4 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 4 rows, and float as the element type. | |
QMatrix3x2 | |
The QMatrix3x2 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 2 rows, and float as the element type. | |
QMatrix3x3 | |
The QMatrix3x3 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 3 rows, and float as the element type. | |
QMatrix3x4 | |
The QMatrix3x4 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 4 rows, and float as the element type. | |
QMatrix4x2 | |
The QMatrix4x2 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 2 rows, and float as the element type. | |
QMatrix4x3 | |
The QMatrix4x3 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 3 rows, and float as the element type. | |
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows.
\inmodule QtGui
The QGenericMatrix template has three parameters:
\table \row
Definition at line 16 of file qgenericmatrix.h.
Q_INLINE_TEMPLATE QGenericMatrix< N, M, T >::QGenericMatrix |
Definition at line 74 of file qgenericmatrix.h.
|
inlineexplicit |
Constructs a NxM matrix without initializing the contents.
Definition at line 20 of file qgenericmatrix.h.
|
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 80 of file qgenericmatrix.h.
References M.
|
inline |
Returns a constant pointer to the raw data of this matrix.
Definition at line 44 of file qgenericmatrix.h.
Referenced by QSSGMaterialShaderGenerator::setRhiMaterialProperties().
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 283 of file qgenericmatrix.h.
References M.
|
inline |
Returns a pointer to the raw data of this matrix.
Definition at line 42 of file qgenericmatrix.h.
Referenced by QMatrix4x4::normalMatrix(), and QDynamicRigidBody::setInertiaMatrix().
|
inline |
Returns a constant pointer to the raw data of this matrix.
Definition at line 43 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 132 of file qgenericmatrix.h.
References M.
Q_OUTOFLINE_TEMPLATE bool QGenericMatrix< N, M, T >::isIdentity |
Returns true
if this matrix is the identity; false otherwise.
Definition at line 102 of file qgenericmatrix.h.
References M.
Referenced by QSSGMaterialShaderGenerator::setRhiMaterialProperties().
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 191 of file qgenericmatrix.h.
References other().
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 95 of file qgenericmatrix.h.
References Q_ASSERT.
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 88 of file qgenericmatrix.h.
References Q_ASSERT.
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 168 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 150 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 159 of file qgenericmatrix.h.
QT_WARNING_POP 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 199 of file qgenericmatrix.h.
References M.
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE 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 180 of file qgenericmatrix.h.
Q_OUTOFLINE_TEMPLATE void QGenericMatrix< N, M, T >::setToIdentity |
Sets this matrix to the identity.
Definition at line 119 of file qgenericmatrix.h.
References M.
Q_OUTOFLINE_TEMPLATE QGenericMatrix< M, N, T > QGenericMatrix< N, M, T >::transposed |
Returns this matrix, transposed about its diagonal.
Definition at line 140 of file qgenericmatrix.h.
References M, and Qt::Uninitialized.
Referenced by QQuick3DNode::mapDirectionFromScene().
|
friend |
Constructs a NxM identity matrix.
Definition at line 65 of file qgenericmatrix.h.
|
related |
Returns the result of multiplying all elements of matrix by factor.
Definition at line 263 of file qgenericmatrix.h.
References M, and Qt::Uninitialized.
|
friend |
Returns the product of the NNxM2 matrix m1 and the M1xNN matrix m2 to produce a M1xM2 matrix result.
|
friend |
|
related |
Returns the result of multiplying all elements of matrix by factor.
Definition at line 253 of file qgenericmatrix.h.
References M, and Qt::Uninitialized.
|
friend |
|
related |
Returns the sum of m1 and m2.
Definition at line 208 of file qgenericmatrix.h.
References M, and Qt::Uninitialized.
|
friend |
|
related |
Returns the difference of m1 and m2.
Definition at line 218 of file qgenericmatrix.h.
References M, and Qt::Uninitialized.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns the negation of matrix.
Definition at line 243 of file qgenericmatrix.h.
|
friend |
|
friend |
|
related |
Returns the result of dividing all elements of matrix by divisor.
Definition at line 273 of file qgenericmatrix.h.
References M, and Qt::Uninitialized.
|
friend |
|
related |
|
related |
|
related |
The QMatrix2x2 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 2 rows, and float as the element type.
Definition at line 291 of file qgenericmatrix.h.
|
related |
The QMatrix2x3 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 3 rows, and float as the element type.
Definition at line 292 of file qgenericmatrix.h.
|
related |
The QMatrix2x4 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 4 rows, and float as the element type.
Definition at line 293 of file qgenericmatrix.h.
|
related |
The QMatrix3x2 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 2 rows, and float as the element type.
Definition at line 294 of file qgenericmatrix.h.
|
related |
The QMatrix3x3 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 3 rows, and float as the element type.
Definition at line 295 of file qgenericmatrix.h.
|
related |
The QMatrix3x4 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 4 rows, and float as the element type.
Definition at line 296 of file qgenericmatrix.h.
|
related |
The QMatrix4x2 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 2 rows, and float as the element type.
Definition at line 297 of file qgenericmatrix.h.
|
related |
The QMatrix4x3 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 3 rows, and float as the element type.
Definition at line 298 of file qgenericmatrix.h.