C
Qul::PlatformInterface::GenericMatrix Struct
template <int M, int N, typename T> struct Qul::PlatformInterface::GenericMatrixGenericMatrix 类是一个表示矩阵的模板类。更多内容...
| Header: | #include <platforminterface/genericmatrix.h> |
| Since: | Qt Quick Ultralite (Platform) 1.7 |
| Inherited By: |
公共类型
| enum | Initialization { Uninitialized, ZeroInitialized, Identity } |
公共函数
| GenericMatrix() | |
| GenericMatrix(Qul::PlatformInterface::GenericMatrix<value-parameter-0-0, value-parameter-0-1, type-parameter-0-2>::Initialization initialization) | |
| GenericMatrix(const T *values) | |
| T * | data() |
| const T * | data() const |
| bool | isIdentity() const |
| void | setToIdentity() |
| bool | operator!=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const |
| T & | operator()(int row, int column) |
| const T & | operator()(int row, int column) const |
| Qul::PlatformInterface::GenericMatrix<M, N, T> & | operator*=(T factor) |
| Qul::PlatformInterface::GenericMatrix<M, N, T> & | operator*=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) |
| Qul::PlatformInterface::GenericMatrix<M, N, T> & | operator+=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) |
| bool | operator==(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const |
相关的非成员
| Qul::PlatformInterface::GenericMatrix<M, N, T2> | operator*(T1 factor, const Qul::PlatformInterface::GenericMatrix<M, N, T2> &matrix) |
| Qul::PlatformInterface::GenericMatrix<M, N2, T> | operator*(const Qul::PlatformInterface::GenericMatrix<M, N1, T> &m1, const Qul::PlatformInterface::GenericMatrix<N1, N2, T> &m2) |
| Qul::PlatformInterface::GenericMatrix<M, N, T> | operator+(const Qul::PlatformInterface::GenericMatrix<M, N, T> &m1, const Qul::PlatformInterface::GenericMatrix<M, N, T> &m2) |
详细说明
GenericMatrix 类是一个表示矩阵的模板类。对于方阵,通过模板特化提供了一些额外的方法。
GenericMatrix 模板有三个参数:
| M | 列数。 |
| N | 行数。 |
| T | 该类用户可见的元素类型。 |
T 必须满足以下条件:
- 可简单复制。
- 可进行默认构造。
- 支持整数构造。
示例:
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::Initialization
此枚举类型用于矩阵初始化策略。
| 常量 | 值 | 描述 |
|---|---|---|
Qul::PlatformInterface::GenericMatrix::Uninitialized | 0 | 构建一个未初始化内容的矩阵。 |
Qul::PlatformInterface::GenericMatrix::ZeroInitialized | 1 | 矩阵内容被初始化为零。 |
Qul::PlatformInterface::GenericMatrix::Identity | 2 | 矩阵内容被设置为单位矩阵。此枚举仅适用于方阵。 |
成员函数文档
GenericMatrix::GenericMatrix()
构建一个初始值为零的矩阵。
[explicit] GenericMatrix::GenericMatrix(Qul::PlatformInterface::GenericMatrix<value-parameter-0-0, value-parameter-0-1, type-parameter-0-2>::Initialization initialization)
根据initialization 策略构建矩阵并设置值。
[explicit] GenericMatrix::GenericMatrix(const T *values)
根据给定的 M × N 维数组 `values` 构建一个矩阵。假设数组 `values ` 的内容按行优先顺序排列。
T *GenericMatrix::data()
返回指向该矩阵原始数据的指针。
const T *GenericMatrix::data() const
返回指向该矩阵原始数据的常量指针。
bool GenericMatrix::isIdentity() const
如果该矩阵是单位矩阵,则返回true ;否则返回false 。
注意:此 方法仅适用于方阵。
另请参阅 setToIdentity()。
void GenericMatrix::setToIdentity()
将该矩阵设置为单位矩阵。
注意:此 方法仅适用于方阵。
另请参阅 isIdentity()。
bool GenericMatrix::operator!=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const
如果该矩阵与other 不相同,则返回true ;否则返回false 。
T &GenericMatrix::operator()(int row, int column)
返回该矩阵中位于位置 (row,column) 的元素的引用,以便可以向该元素赋值。
const T &GenericMatrix::operator()(int row, int column) const
返回指向该矩阵中位置为 (row,column) 的元素的常量引用。
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator*=(T factor)
将该矩阵的所有元素与标量factor 相乘。
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator*=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other)
将该矩阵的所有元素与矩阵other 相乘。
注意:此 方法仅适用于方阵。
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator+=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other)
将other 中的内容添加到该矩阵中。
bool GenericMatrix::operator==(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const
如果该矩阵与other 完全相同,则返回true ;否则返回false 。
相关非成员
template < int M, int N, typename T1, typename T2 > Qul::PlatformInterface::GenericMatrix<M, N, T2> operator*(T1 factor, const Qul::PlatformInterface::GenericMatrix<M, N, T2> &matrix)
返回将matrix 中的所有元素与标量factor 相乘的结果。
template < int M, int N1, int N2, typename T > Qul::PlatformInterface::GenericMatrix<M, N2, T> operator*(const Qul::PlatformInterface::GenericMatrix<M, N1, T> &m1, const Qul::PlatformInterface::GenericMatrix<N1, N2, T> &m2)
返回m1 和m2 中所有元素相乘的结果。
template < int M, int N, typename T > Qul::PlatformInterface::GenericMatrix<M, N, T> operator+(const Qul::PlatformInterface::GenericMatrix<M, N, T> &m1, const Qul::PlatformInterface::GenericMatrix<M, N, T> &m2)
返回m1 和m2 的和。
在某些 Qt 许可下可用。
了解更多信息。