CopperSpice API  1.9.1
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...

Public Methods

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

Friends

template<int NN, int MM, typename TT >
class QGenericMatrix
 

Related Functions

These are not member functions

QGenericMatrix< N, M, T > operator* (const QGenericMatrix< N, M, T > &matrix, T factor)
 
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 > &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)
 
QDataStreamoperator<< (QDataStream &stream, const QGenericMatrix< N, M, T > &matrix)
 
QDataStreamoperator>> (QDataStream &stream, QGenericMatrix< N, M, T > &matrix)
 
typedef QMatrix2x2
 
typedef QMatrix2x3
 
typedef QMatrix2x4
 
typedef QMatrix3x2
 
typedef QMatrix3x3
 
typedef QMatrix3x4
 
typedef QMatrix4x2
 
typedef 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.

The QGenericMatrix template has three parameters:

NNumber of columns.
MNumber of rows.
TElement type that is visible to users of the class.
See also
QMatrix4x4

Method Documentation

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()
template<int N, int M, typename T >
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.

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()
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()
template<int N, int M, typename T >
void QGenericMatrix< N, M, T >::fill ( value)

Fills all elements of this matrix with value.

template<int N, int M, typename T >
bool QGenericMatrix< N, M, T >::isIdentity ( ) const

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

See also
setToIdentity()
template<int N, int M, typename T >
T & QGenericMatrix< N, M, T >::operator () ( int  row,
int  column 
)
inline

Returns a reference to the element at position (row, column) in this matrix so that the element can be assigned to.

template<int N, int M, typename T >
const T & QGenericMatrix< N, M, T >::operator () ( int  row,
int  column 
) const
inline

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

template<int N, int M, typename T >
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.

template<int N, int M, typename T >
QGenericMatrix< N, M, T > & QGenericMatrix< N, M, T >::operator*= ( factor)

Multiplies all elements of this matrix by factor.

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

Adds the contents of other to this matrix.

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

Subtracts the contents of other from this matrix.

template<int N, int M, typename T >
QGenericMatrix< N, M, T > & QGenericMatrix< N, M, T >::operator/= ( divisor)

Divides all elements of this matrix by divisor.

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

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

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

Sets this matrix to the identity.

See also
isIdentity()
template<int N, int M, typename T >
QGenericMatrix< M, N, T > QGenericMatrix< N, M, T >::transposed ( ) const

Returns this matrix, transposed about its diagonal.

Friends And Related Function Documentation

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

Constructs a NxM identity matrix.

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

Constructs a copy of other.

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

Copy constructs a new QGenericMatrix from other.

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

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

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

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

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

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 
)
related

Returns the sum of m1 and m2.

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.

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

Returns the negation of matrix.

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

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

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

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

Refer to Serializing Data Types for additional information.

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

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

Refer to Serializing Data Types for additional information.

typedef QMatrix2x2 ( )
related

The QMatrix2x2 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 2 rows, and qreal as the element type.

typedef QMatrix2x3 ( )
related

The QMatrix2x3 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 3 rows, and qreal as the element type.

typedef QMatrix2x4 ( )
related

The QMatrix2x4 type defines a convenient instantiation of the QGenericMatrix template for 2 columns, 4 rows, and qreal as the element type.

typedef QMatrix3x2 ( )
related

The QMatrix3x2 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 2 rows, and qreal as the element type.

typedef QMatrix3x3 ( )
related

The QMatrix3x3 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 3 rows, and qreal as the element type.

typedef QMatrix3x4 ( )
related

The QMatrix3x4 type defines a convenient instantiation of the QGenericMatrix template for 3 columns, 4 rows, and qreal as the element type.

typedef QMatrix4x2 ( )
related

The QMatrix4x2 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 2 rows, and qreal as the element type.

typedef QMatrix4x3 ( )
related

The QMatrix4x3 type defines a convenient instantiation of the QGenericMatrix template for 4 columns, 3 rows, and qreal as the element type.