Qt 4.6: QGenericMatrix Class Reference

|  | Home · All Classes · Overviews |

# QGenericMatrix Class Reference
[QtGui module]

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

     #include <QGenericMatrix>

This class was introduced in Qt 4.6.

- List of all members, including inherited members

## Public Functions

| QGenericMatrix ()
| QGenericMatrix ( const QGenericMatrix<N, M, T> & other )
| QGenericMatrix ( const T * values )
const T * | constData () const
T * | data ()
const T * | data () const
void | fill ( T value )
bool | isIdentity () const
void | setIdentity ()
void | toValueArray ( T * values )
QGenericMatrix<M, N, T> | transposed () const
bool | operator!= ( const QGenericMatrix<N, M, T> & other ) const
const T & | operator() ( int row, int column ) const
T & | operator() ( int row, int column )
QGenericMatrix<N, M, T> & | operator*= ( T factor )
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 divisor )
bool | operator== ( const QGenericMatrix<N, M, T> & other ) const

## Related Non-Members

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 )
QGenericMatrix<N, M, T> | operator- ( const QGenericMatrix<N, M, T> & m1, const QGenericMatrix<N, M, T> & m2 )
QGenericMatrix<N, M, T> | operator- ( const QGenericMatrix<N, M, T> & matrix )
QGenericMatrix<N, M, T> | operator/ ( const QGenericMatrix<N, M, T> & matrix, T divisor )

## Detailed Description

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.

See also QMatrix4x4.

## Member Function Documentation

### QGenericMatrix::QGenericMatrix ()

Constructs a NxM identity matrix.

### QGenericMatrix::QGenericMatrix ( const QGenericMatrix<N, M, T> & other )

Constructs a copy of other.

### QGenericMatrix::QGenericMatrix ( const T * values )

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 toValueArray().

### const T * QGenericMatrix::constData () const

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

See also data().

### T * QGenericMatrix::data ()

Returns a pointer to the raw data of this matrix.

See also constData().

### const T * QGenericMatrix::data () const

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

See also constData().

### void QGenericMatrix::fill ( T value )

Fills all elements of this matrix with value.

### bool QGenericMatrix::isIdentity () const

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

See also setIdentity().

### void QGenericMatrix::setIdentity ()

Sets this matrix to the identity.

See also isIdentity().

### void QGenericMatrix::toValueArray ( T * values )

Retrieves the N * M items in this matrix and writes them to values in row-major order.

### QGenericMatrix<M, N, T> QGenericMatrix::transposed () const

Returns this matrix, transposed about its diagonal.

### bool QGenericMatrix::operator!= ( const QGenericMatrix<N, M, T> & other ) const

Returns true if this matrix is not identical to other; false otherwise.

### const T & QGenericMatrix::operator() ( int row, int column ) const

Returns a constant reference to the element at position (row, column) in this matrix.

### T & QGenericMatrix::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.

### QGenericMatrix<N, M, T> & QGenericMatrix::operator*= ( T factor )

Multiplies all elements of this matrix by factor.

### QGenericMatrix<N, M, T> & QGenericMatrix::operator+= ( const QGenericMatrix<N, M, T> & other )

Adds the contents of other to this matrix.

### QGenericMatrix<N, M, T> & QGenericMatrix::operator-= ( const QGenericMatrix<N, M, T> & other )

Subtracts the contents of other from this matrix.

### QGenericMatrix<N, M, T> & QGenericMatrix::operator/= ( T divisor )

Divides all elements of this matrix by divisor.

### bool QGenericMatrix::operator== ( const QGenericMatrix<N, M, T> & other ) const

Returns true if this matrix is identical to other; false otherwise.

## Related Non-Members

### QGenericMatrix<M1, M2, T> operator* ( const QGenericMatrix<N, M2, T> & m1, const QGenericMatrix<M1, N, T> & m2 )

Returns the product of the NxM2 matrix m1 and the M1xN matrix m2 to produce a M1xM2 matrix result.

### QGenericMatrix<N, M, T> operator* ( T factor, const QGenericMatrix<N, M, T> & matrix )

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

### QGenericMatrix<N, M, T> operator* ( const QGenericMatrix<N, M, T> & matrix, T factor )

Returns the result of multiplying all elements of matrix by 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.

### QGenericMatrix<N, M, T> operator- ( const QGenericMatrix<N, M, T> & m1, const QGenericMatrix<N, M, T> & m2 )

Returns the difference of m1 and m2.

### QGenericMatrix<N, M, T> operator- ( const QGenericMatrix<N, M, T> & matrix )

This is an overloaded function.

Returns the negation of matrix.

### QGenericMatrix<N, M, T> operator/ ( const QGenericMatrix<N, M, T> & matrix, T divisor )

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