GenericMatrix Struct

template <int M, int N, typename T> struct Qul :: PlatformInterface ::GenericMatrix

The GenericMatrix class is a template class representing a matrix. 更多...

Header: #include <platforminterface/genericmatrix.h>
Since: Qt Quick Ultralite (Platform) 1.7
继承者:

Qul::PlatformInterface::Transform

This struct was introduced in Qt Quick Ultralite (Platform) 1.7.

公共类型

enum 初始化 { Uninitialized, ZeroInitialized, Identity }

公共函数

GenericMatrix (const T * values )
GenericMatrix (Qul::PlatformInterface::GenericMatrix::Initialization initialization )
GenericMatrix ()
const T * data () const
T * data ()
bool isIdentity () const
void setToIdentity ()
bool operator!= (const GenericMatrix<M, N, T> & other = M) const
const T & operator() (int row , int column ) const
T & operator() (int row , int column )
GenericMatrix<M, N, T> & operator*= (T factor )
GenericMatrix<M, N, T> & operator*= (const GenericMatrix<M, N, T> & other = M)
GenericMatrix<M, N, T> & operator+= (const GenericMatrix<M, N, T> & other = M)
bool operator== (const GenericMatrix<M, N, T> & other = M) const
GenericMatrix<M, N, T2> operator* (T1 factor , const GenericMatrix<M, N, T2> & matrix = M)
GenericMatrix<M, N2, T> operator* (const GenericMatrix<M, N1, T> & m1 = M, const GenericMatrix<N1, N2, T> & m2 = N1)
GenericMatrix<M, N, T> operator+ (const GenericMatrix<M, N, T> & m1 = M, const GenericMatrix<M, N, T> & m2 = M)

详细描述

The GenericMatrix class is a template class representing a matrix. For square matrices, few additinal methods are provided by template specialization.

The GenericMatrix template has three parameters:

M 列数。
N 行数。
T 类用户可见的元素类型。

The T must be:

  • Trivially copyable.
  • Default constructible.
  • Integer constructible.

范例:

using Qul::PlatformInterface::GenericMatrix;
// Specializes a square matrix.
using Matrix5x5 = GenericMatrix<5, 5, float>;
Matrix5x5 m(Matrix5x5::Identity);
m.isIdentity();
// Specializes a rectangular matrix.
using Matrix2x3 = GenericMatrix<2, 3, float>;
Matrix2x3 m2(Matrix2x3::Uninitialized);
							

成员类型文档编制

enum GenericMatrix:: 初始化

This enum type is used for matrix initialization policy.

常量 描述
Qul::PlatformInterface::GenericMatrix::Uninitialized 0 Constructs a matrix without initializing the contents.
Qul::PlatformInterface::GenericMatrix::ZeroInitialized 1 Matrix content is zero initialized.
Qul::PlatformInterface::GenericMatrix::Identity 2 Matrix content is set to the identity matrix. This enum is available only for square matrices.

成员函数文档编制

GenericMatrix:: GenericMatrix (const T * values )

Constructs a matrix from the given M * N values . The contents of the values array are assumed to be in row-major order.

GenericMatrix:: GenericMatrix ( Qul::PlatformInterface::GenericMatrix::Initialization initialization )

Constructs matrix and sets values according to initialization policy.

GenericMatrix:: GenericMatrix ()

Constructs matrix with zero-initialized values.

const T *GenericMatrix:: data () const

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

T *GenericMatrix:: data ()

Returns a pointer to the raw data of this matrix.

bool GenericMatrix:: isIdentity () const

返回 true if this matrix is the identity, returns false 否则。

注意: This method is available only for square matrices.

另请参阅 setToIdentity ().

void GenericMatrix:: setToIdentity ()

将此矩阵设为恒等。

注意: This method is available only for square matrices.

另请参阅 isIdentity ().

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

返回 true if this matrix is not identical to other , returns false 否则。

const T &GenericMatrix:: operator() ( int row , int column ) const

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

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

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

Multiplies all elements of this matrix by scalar factor .

GenericMatrix < M , N , T > &GenericMatrix:: operator*= (const GenericMatrix < M , N , T > & other = M)

Multiplies all elements of this matrix with other matrix.

注意: This method is available only for square matrices.

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

Adds the contents of other to this matrix.

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

返回 true if this matrix is identical to other , returns false 否则。

相关非成员

template <int M, int N, typename T1, typename T2> GenericMatrix < M , N , T2 > operator* ( T1 factor , const GenericMatrix < M , N , T2 > & matrix = M)

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

template <int M, int N1, int N2, typename T> GenericMatrix < M , N2 , T > operator* (const GenericMatrix < M , N1 , T > & m1 = M, const GenericMatrix < N1 , N2 , T > & m2 = N1)

Returns the result of multiplying all elements of m1 and m2 .

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

Returns the sum of m1 and m2 .