このページでは

QGenericMatrix Class

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

QGenericMatrix クラスは、N 列 M 行の変換行列を表すテンプレートクラスです。詳細...

ヘッダー: #include <QGenericMatrix>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui

パブリック関数

QGenericMatrix()
QGenericMatrix(const T *values)
const T *constData() const
void copyDataTo(T *values) const
T *data()
const T *data() const
void fill(T value)
bool isIdentity() const
void setToIdentity()
QGenericMatrix<M, N, T> transposed() const
bool operator!=(const QGenericMatrix<N, M, T> &other) const
T &operator()(int row, int column)
const T &operator()(int row, int column) 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
QMatrix2x2
QMatrix2x3
QMatrix2x4
QMatrix3x2
QMatrix3x3
QMatrix3x4
QMatrix4x2
QMatrix4x3
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<M1, M2, TT> operator*(const QGenericMatrix<NN, M2, TT> &m1, const QGenericMatrix<M1, NN, TT> &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> &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)
QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix)
QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix)

詳細な説明

QGenericMatrix<N, M, T> は、N が列数、M が行数、T がクラスのユーザーに表示される要素型であるテンプレートクラスです。

QMatrix4x4も参照してください 。

メンバ関数のドキュメント

QGenericMatrix::QGenericMatrix()

N ×M の単位行列を作成します。

[explicit] QGenericMatrix::QGenericMatrix(const T *values)

指定されたN *M の浮動小数点数values から行列を構築します。配列values の内容は、行優先順序であるとみなされます。

copyDataTo()も参照してください 。

const T *QGenericMatrix::constData() const

この行列の生データへの定数ポインタを返します。

data()も参照してください 。

void QGenericMatrix::copyDataTo(T *values) const

この行列からN *M の要素を取得し、それらを行優先順でvalues にコピーします。

T *QGenericMatrix::data()

この行列の生データへのポインタを返します。

constData()も参照してください 。

const T *QGenericMatrix::data() const

この行列の生データへの定数ポインタを返します。

constData()も参照してください 。

void QGenericMatrix::fill(T value)

この行列のすべての要素をvalue で埋めます。

bool QGenericMatrix::isIdentity() const

この行列が単位行列である場合は `true ` を返し、そうでない場合は `false` を返します。

setToIdentity()も参照してください 。

void QGenericMatrix::setToIdentity()

この行列を単位行列に設定します。

isIdentity()も参照してください 。

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

この行列を、対角線を中心として転置した行列を返します。

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

この行列が `other` と同一でない場合は `true ` を返し、それ以外の場合は `false` を返す。

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

この行列内の位置 (row,column) にある要素への参照を返し、その要素に値を代入できるようにします。

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

この行列の (row,column) の位置にある要素への定数参照を返します。

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

この行列のすべての要素にfactor を乗算します。

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

other の内容をこの行列に加算します。

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

この行列から、other の内容を差し引きます。

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

この行列のすべての要素を、divisor で割ります。

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

この行列が `other` と同一である場合は `true ` を返し、そうでない場合は `false` を返します。

関連する非メンバー

QMatrix2x2

QMatrix2x2 型は、2 列、2 行、要素型として float を持つ `QGenericMatrix ` テンプレートの便利なインスタンス化を定義しています。

QMatrix2x3

QMatrix2x3 型は、2 列、3 行、要素型として float を持つ `QGenericMatrix ` テンプレートの便利なインスタンス化を定義しています。

QMatrix2x4

QMatrix2x4 型は、2 列、4 行、要素型として float を持つQGenericMatrix テンプレートの便利なインスタンス化を定義しています。

QMatrix3x2

QMatrix3x2 型は、3 列、2 行、要素型として float を持つ、QGenericMatrix テンプレートの便利なインスタンス化を定義しています。

QMatrix3x3

QMatrix3x3 型は、3 列、3 行、要素型として float を持つ、QGenericMatrix テンプレートの便利なインスタンス化を定義しています。

QMatrix3x4

QMatrix3x4 型は、3 列、4 行、要素型として float を持つ、QGenericMatrix テンプレートの便利なインスタンス化を定義しています。

QMatrix4x2

QMatrix4x2 型は、列数 4、行数 2、要素型として float を用いた、QGenericMatrix テンプレートの便利なインスタンス化を定義しています。

QMatrix4x3

QMatrix4x3 型は、4 列、3 行、要素型として float を持つ、QGenericMatrix テンプレートの便利なインスタンス化を定義しています。

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

N のすべての要素と、M matrix のすべての要素を、factor で乗算した結果を返します。

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

matrix のすべての要素とfactor を乗算した結果を返します。

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)

NN ×M2 の行列m1 と、M1 ×NN の行列m2 を掛け合わせ、M1 ×M2 の行列resultを生成します。

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

N ×M の行列m1 およびm2 の和を返します。

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

N ×M の行列であるm1 とm2 の差を返します。

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

matrix の否定を返します。

これはオーバーロードされた関数です。

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

N xM matrix のすべての要素をdivisor で割った結果を返します。

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

指定されたN xM matrix を、指定されたstream に書き込み、そのストリームへの参照を返します。

「Qt データ型のシリアライズ」も参照してください 。

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

指定されたstream からN ×M の行列を読み取り、指定されたmatrix に格納し、そのストリームへの参照を返します。

「Qtデータ型のシリアライズ」も参照してください 。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.