QtBase  v6.3.1
Public Member Functions | Friends | Related Functions | List of all members
QGenericMatrix< N, M, T > Class Template Reference

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)
 
const Toperator() (int row, int column) const
 
Toperator() (int row, int column)
 
bool isIdentity () const
 
void setToIdentity ()
 
void fill (T value)
 
QGenericMatrix< M, N, Ttransposed () const
 
QGenericMatrix< N, M, T > & operator+= (const QGenericMatrix< N, M, T > &other)
 
QGenericMatrix< N, M, T > & operator-= (const QGenericMatrix< N, M, T > &other)
 
QGenericMatrix< N, M, T > & operator*= (T factor)
 
QGenericMatrix< N, M, T > & operator/= (T divisor)
 
bool operator== (const QGenericMatrix< N, M, T > &other) const
 
bool operator!= (const QGenericMatrix< N, M, T > &other) const
 
void copyDataTo (T *values) const
 
Tdata ()
 
const Tdata () const
 
const TconstData () const
 

Friends

template<int NN, int MM, typename TT >
class QGenericMatrix
 
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)
 
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 Functions

(Note that these are not member functions.)

template< int N, int M, typename T > QGenericMatrix< N, M, Toperator+ (const QGenericMatrix< N, M, T > &m1, const QGenericMatrix< N, M, T > &m2)
 
template< int N, int M, typename T > QGenericMatrix< N, M, Toperator- (const QGenericMatrix< N, M, T > &m1, const QGenericMatrix< N, M, T > &m2)
 
template< int N, int M, typename T > QGenericMatrix< N, M, Toperator- (const QGenericMatrix< N, M, T > &matrix)
 
template< int N, int M, typename T > QGenericMatrix< N, M, Toperator* (T factor, const QGenericMatrix< N, M, T > &matrix)
 
template< int N, int M, typename T > QGenericMatrix< N, M, Toperator* (const QGenericMatrix< N, M, T > &matrix, T factor)
 
template< int N, int M, typename T > QGenericMatrix< N, M, Toperator/ (const QGenericMatrix< N, M, T > &matrix, T divisor)
 
template< int N, int M, typename T > QDataStreamoperator<< (QDataStream &stream, const QGenericMatrix< N, M, T > &matrix)
 
template< int N, int M, typename T > QDataStreamoperator>> (QDataStream &stream, QGenericMatrix< N, M, T > &matrix)
 
 QMatrix2x2
 
 QMatrix2x3
 
 QMatrix2x4
 
 QMatrix3x2
 
 QMatrix3x3
 
 QMatrix3x4
 
 QMatrix4x2
 
 QMatrix4x3
 

Detailed Description

template<int N, int M, typename T>
class QGenericMatrix< N, M, T >

The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows.

Since
4.6

\inmodule QtGui

The QGenericMatrix template has three parameters:

\table \row

See also
QMatrix4x4

Definition at line 52 of file qgenericmatrix.h.

Constructor & Destructor Documentation

◆ QGenericMatrix() [1/3]

template<int N, int M, typename T >
Q_INLINE_TEMPLATE QGenericMatrix< N, M, T >::QGenericMatrix

Definition at line 110 of file qgenericmatrix.h.

◆ QGenericMatrix() [2/3]

template<int N, int M, typename T >
template< int N, int M, typename T > QGenericMatrix< N, M, T >::QGenericMatrix ( Qt::Initialization  )
inlineexplicit
Since
5.5

Definition at line 56 of file qgenericmatrix.h.

◆ QGenericMatrix() [3/3]

template<int N, int M, typename T >
Q_OUTOFLINE_TEMPLATE QGenericMatrix< N, M, T >::QGenericMatrix ( const T values)
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.

See also
copyDataTo()

Definition at line 116 of file qgenericmatrix.h.

Member Function Documentation

◆ constData()

template<int N, int M, typename T >
template< int N, int M, typename T > const T * QGenericMatrix< N, M, T >::constData ( ) const
inline

Returns a constant pointer to the raw data of this matrix.

See also
data()

Definition at line 80 of file qgenericmatrix.h.

◆ copyDataTo()

template<int N, int M, typename T >
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 319 of file qgenericmatrix.h.

◆ data() [1/2]

template<int N, int M, typename T >
template< int N, int M, typename T > T * QGenericMatrix< N, M, T >::data ( )
inline

Returns a pointer to the raw data of this matrix.

See also
constData()

Definition at line 78 of file qgenericmatrix.h.

Here is the caller graph for this function:

◆ data() [2/2]

template<int N, int M, typename T >
template< int N, int M, typename T > const T * QGenericMatrix< N, M, T >::data ( ) const
inline

Returns a constant pointer to the raw data of this matrix.

See also
constData()

Definition at line 79 of file qgenericmatrix.h.

Here is the caller graph for this function:

◆ fill()

template<int N, int M, typename T >
Q_OUTOFLINE_TEMPLATE void QGenericMatrix< N, M, T >::fill ( T  value)

Fills all elements of this matrix with value.

Definition at line 168 of file qgenericmatrix.h.

◆ isIdentity()

template<int N, int M, typename T >
Q_OUTOFLINE_TEMPLATE bool QGenericMatrix< N, M, T >::isIdentity

Returns true if this matrix is the identity; false otherwise.

See also
setToIdentity()

Definition at line 138 of file qgenericmatrix.h.

◆ operator!=()

template<int N, int M, typename T >
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 227 of file qgenericmatrix.h.

Here is the call graph for this function:

◆ operator()() [1/2]

template<int N, int M, typename T >
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 131 of file qgenericmatrix.h.

◆ operator()() [2/2]

template<int N, int M, typename T >
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 124 of file qgenericmatrix.h.

◆ operator*=()

template<int N, int M, typename T >
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 204 of file qgenericmatrix.h.

◆ operator+=()

template<int N, int M, typename T >
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 186 of file qgenericmatrix.h.

Here is the call graph for this function:

◆ operator-=()

template<int N, int M, typename T >
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 195 of file qgenericmatrix.h.

Here is the call graph for this function:

◆ operator/=()

template<int N, int M, typename T >
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 235 of file qgenericmatrix.h.

◆ operator==()

template<int N, int M, typename T >
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 216 of file qgenericmatrix.h.

Here is the call graph for this function:

◆ setToIdentity()

template<int N, int M, typename T >
Q_OUTOFLINE_TEMPLATE void QGenericMatrix< N, M, T >::setToIdentity

Sets this matrix to the identity.

See also
isIdentity()

Definition at line 155 of file qgenericmatrix.h.

◆ transposed()

template<int N, int M, typename T >
Q_OUTOFLINE_TEMPLATE QGenericMatrix< M, N, T > QGenericMatrix< N, M, T >::transposed

Returns this matrix, transposed about its diagonal.

Definition at line 176 of file qgenericmatrix.h.

Friends And Related Function Documentation

◆ operator*() [1/5]

template<int N, int M, typename T >
template< int N, int M, typename T > QGenericMatrix< N, M, T > operator* ( const QGenericMatrix< N, M, T > &  matrix,
T  factor 
)
related

Returns the result of multiplying all elements of matrix by factor.

Definition at line 299 of file qgenericmatrix.h.

◆ operator* [2/5]

template<int N, int M, typename T >
template<int NN, int M1, int M2, typename TT >
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 
)
friend

Returns the product of the NNxM2 matrix m1 and the M1xNN matrix m2 to produce a M1xM2 matrix result.

◆ operator* [3/5]

template<int N, int M, typename T >
template<int NN, int MM, typename TT >
QGenericMatrix<NN, MM, TT> operator* ( const QGenericMatrix< NN, MM, TT > &  matrix,
TT  factor 
)
friend

◆ operator*() [4/5]

template<int N, int M, typename T >
template< int N, int M, typename T > QGenericMatrix< N, M, T > operator* ( T  factor,
const QGenericMatrix< N, M, T > &  matrix 
)
related

Returns the result of multiplying all elements of matrix by factor.

Definition at line 289 of file qgenericmatrix.h.

◆ operator* [5/5]

template<int N, int M, typename T >
template<int NN, int MM, typename TT >
QGenericMatrix<NN, MM, TT> operator* ( TT  factor,
const QGenericMatrix< NN, MM, TT > &  matrix 
)
friend

◆ operator+() [1/2]

template<int N, int M, typename T >
template< int N, int M, typename T > QGenericMatrix< N, M, T > operator+ ( const QGenericMatrix< N, M, T > &  m1,
const QGenericMatrix< N, M, T > &  m2 
)
related

Returns the sum of m1 and m2.

Definition at line 244 of file qgenericmatrix.h.

◆ operator+ [2/2]

template<int N, int M, typename T >
template<int NN, int MM, typename TT >
QGenericMatrix<NN, MM, TT> operator+ ( const QGenericMatrix< NN, MM, TT > &  m1,
const QGenericMatrix< NN, MM, TT > &  m2 
)
friend

◆ operator-() [1/4]

template<int N, int M, typename T >
template< int N, int M, typename T > QGenericMatrix< N, M, T > operator- ( const QGenericMatrix< N, M, T > &  m1,
const QGenericMatrix< N, M, T > &  m2 
)
related

Returns the difference of m1 and m2.

Definition at line 254 of file qgenericmatrix.h.

◆ operator-() [2/4]

template<int N, int M, typename T >
template< int N, int M, typename T > QGenericMatrix< N, M, T > operator- ( const QGenericMatrix< N, M, T > &  matrix)
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 279 of file qgenericmatrix.h.

◆ operator- [3/4]

template<int N, int M, typename T >
template<int NN, int MM, typename TT >
QGenericMatrix<NN, MM, TT> operator- ( const QGenericMatrix< NN, MM, TT > &  m1,
const QGenericMatrix< NN, MM, TT > &  m2 
)
friend

◆ operator- [4/4]

template<int N, int M, typename T >
template<int NN, int MM, typename TT >
QGenericMatrix<NN, MM, TT> operator- ( const QGenericMatrix< NN, MM, TT > &  matrix)
friend

◆ operator/() [1/2]

template<int N, int M, typename T >
template< int N, int M, typename T > QGenericMatrix< N, M, T > operator/ ( const QGenericMatrix< N, M, T > &  matrix,
T  divisor 
)
related

Returns the result of dividing all elements of matrix by divisor.

Definition at line 309 of file qgenericmatrix.h.

◆ operator/ [2/2]

template<int N, int M, typename T >
template<int NN, int MM, typename TT >
QGenericMatrix<NN, MM, TT> operator/ ( const QGenericMatrix< NN, MM, TT > &  matrix,
TT  divisor 
)
friend

◆ operator<<()

template<int N, int M, typename T >
template< int N, int M, typename T > QDataStream & operator<< ( QDataStream stream,
const QGenericMatrix< N, M, T > &  matrix 
)
related

Writes the given matrix to the given stream and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 359 of file qgenericmatrix.h.

◆ operator>>()

template<int N, int M, typename T >
template< int N, int M, typename T > QDataStream & operator>> ( QDataStream stream,
QGenericMatrix< N, M, T > &  matrix 
)
related

Reads a NxM matrix from the given stream into the given matrix and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 368 of file qgenericmatrix.h.

◆ QGenericMatrix

template<int N, int M, typename T >
template<int NN, int MM, typename TT >
template< int N, int M, typename T > QGenericMatrix< N, M, T >::QGenericMatrix
friend

Constructs a NxM identity matrix.

Definition at line 101 of file qgenericmatrix.h.

◆ QMatrix2x2()

template<int N, int M, typename T >
QMatrix2x2
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 327 of file qgenericmatrix.h.

◆ QMatrix2x3()

template<int N, int M, typename T >
QMatrix2x3
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 328 of file qgenericmatrix.h.

◆ QMatrix2x4()

template<int N, int M, typename T >
QMatrix2x4
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 329 of file qgenericmatrix.h.

◆ QMatrix3x2()

template<int N, int M, typename T >
QMatrix3x2
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 330 of file qgenericmatrix.h.

◆ QMatrix3x3()

template<int N, int M, typename T >
QMatrix3x3
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 331 of file qgenericmatrix.h.

◆ QMatrix3x4()

template<int N, int M, typename T >
QMatrix3x4
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 332 of file qgenericmatrix.h.

◆ QMatrix4x2()

template<int N, int M, typename T >
QMatrix4x2
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 333 of file qgenericmatrix.h.

◆ QMatrix4x3()

template<int N, int M, typename T >
QMatrix4x3
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 334 of file qgenericmatrix.h.


The documentation for this class was generated from the following files: