- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Friends

# QMatrix4x4 Class Reference

Search for all occurrences

## Detailed Description

Definition at line 63 of file qmatrix4x4.h.

`#include <qmatrix4x4.h>`

List of all members.

## Public Member Functions
| QMatrix4x4 ()
| QMatrix4x4 (const qreal *values)
| QMatrix4x4 (qreal m11, qreal m12, qreal m13, qreal m14, qreal m21, qreal m22, qreal m23, qreal m24, qreal m31, qreal m32, qreal m33, qreal m34, qreal m41, qreal m42, qreal m43, qreal m44)
template<int N, int M>
| QMatrix4x4 (const QGenericMatrix< N, M, qreal > &matrix)
| QMatrix4x4 (const qreal *values, int cols, int rows)
| QMatrix4x4 (const QTransform &transform)
| QMatrix4x4 (const QMatrix &matrix)
const qreal & | operator() (int row, int column) const
qreal & | operator() (int row, int column)
QVector4D | column (int index) const
void | setColumn (int index, const QVector4D &value)
QVector4D | row (int index) const
void | setRow (int index, const QVector4D &value)
bool | isIdentity () const
void | setToIdentity ()
void | fill (qreal value)
qreal | determinant () const
QMatrix4x4 | inverted (bool *invertible=0) const
QMatrix4x4 | transposed () const
QMatrix3x3 | normalMatrix () const
QMatrix4x4 & | operator+= (const QMatrix4x4 &other)
QMatrix4x4 & | operator-= (const QMatrix4x4 &other)
QMatrix4x4 & | operator*= (const QMatrix4x4 &other)
QMatrix4x4 & | operator*= (qreal factor)
QMatrix4x4 & | operator/= (qreal divisor)
bool | operator== (const QMatrix4x4 &other) const
bool | operator!= (const QMatrix4x4 &other) const
void | scale (const QVector3D &vector)
void | translate (const QVector3D &vector)
void | rotate (qreal angle, const QVector3D &vector)
void | scale (qreal x, qreal y)
void | scale (qreal x, qreal y, qreal z)
void | scale (qreal factor)
void | translate (qreal x, qreal y)
void | translate (qreal x, qreal y, qreal z)
void | rotate (qreal angle, qreal x, qreal y, qreal z=0.0f)
void | rotate (const QQuaternion &quaternion)
void | ortho (const QRect &rect)
void | ortho (const QRectF &rect)
void | ortho (qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane)
void | frustum (qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane)
void | perspective (qreal angle, qreal aspect, qreal nearPlane, qreal farPlane)
void | lookAt (const QVector3D &eye, const QVector3D &center, const QVector3D &up)
void | flipCoordinates ()
void | copyDataTo (qreal *values) const
QMatrix | toAffine () const
QTransform | toTransform () const
QTransform | toTransform (qreal distanceToPlane) const
QPoint | map (const QPoint &point) const
QPointF | map (const QPointF &point) const
QVector3D | map (const QVector3D &point) const
QVector3D | mapVector (const QVector3D &vector) const
QVector4D | map (const QVector4D &point) const
QRect | mapRect (const QRect &rect) const
QRectF | mapRect (const QRectF &rect) const
template<int N, int M>
QGenericMatrix< N, M, qreal > | toGenericMatrix () const
qreal * | data ()
const qreal * | data () const
const qreal * | constData () const
void | optimize ()
| operator QVariant () const
## Friends
class | QGraphicsRotation
QMatrix4x4 | operator+ (const QMatrix4x4 &m1, const QMatrix4x4 &m2)
QMatrix4x4 | operator- (const QMatrix4x4 &m1, const QMatrix4x4 &m2)
QMatrix4x4 | operator* (const QMatrix4x4 &m1, const QMatrix4x4 &m2)
QVector3D | operator* (const QMatrix4x4 &matrix, const QVector3D &vector)
QVector3D | operator* (const QVector3D &vector, const QMatrix4x4 &matrix)
QVector4D | operator* (const QVector4D &vector, const QMatrix4x4 &matrix)
QVector4D | operator* (const QMatrix4x4 &matrix, const QVector4D &vector)
QPoint | operator* (const QPoint &point, const QMatrix4x4 &matrix)
QPointF | operator* (const QPointF &point, const QMatrix4x4 &matrix)
QMatrix4x4 | operator- (const QMatrix4x4 &matrix)
QPoint | operator* (const QMatrix4x4 &matrix, const QPoint &point)
QPointF | operator* (const QMatrix4x4 &matrix, const QPointF &point)
QMatrix4x4 | operator* (qreal factor, const QMatrix4x4 &matrix)
QMatrix4x4 | operator* (const QMatrix4x4 &matrix, qreal factor)
Q_GUI_EXPORT QMatrix4x4 | operator/ (const QMatrix4x4 &matrix, qreal divisor)
bool | qFuzzyCompare (const QMatrix4x4 &m1, const QMatrix4x4 &m2)
Q_GUI_EXPORT QDebug | operator<< (QDebug dbg, const QMatrix4x4 &m)

## Constructor & Destructor Documentation

QMatrix4x4 | ( |  | ) | `[inline]`

Definition at line 66 of file qmatrix4x4.h.

    { setToIdentity(); }

QMatrix4x4 | ( | const qreal * | values | ) | `[explicit]`

QMatrix4x4 | ( | qreal | m11,
|  | qreal | m12,
|  | qreal | m13,
|  | qreal | m14,
|  | qreal | m21,
|  | qreal | m22,
|  | qreal | m23,
|  | qreal | m24,
|  | qreal | m31,
|  | qreal | m32,
|  | qreal | m33,
|  | qreal | m34,
|  | qreal | m41,
|  | qreal | m42,
|  | qreal | m43,
|  | qreal | m44
| ) |  | `[inline]`

Definition at line 214 of file qmatrix4x4.h.

    {
        m[0][0] = m11; m[0][1] = m21; m[0][2] = m31; m[0][3] = m41;
        m[1][0] = m12; m[1][1] = m22; m[1][2] = m32; m[1][3] = m42;
        m[2][0] = m13; m[2][1] = m23; m[2][2] = m33; m[2][3] = m43;
        m[3][0] = m14; m[3][1] = m24; m[3][2] = m34; m[3][3] = m44;
        flagBits = General;
    }

Q_INLINE_TEMPLATE QMatrix4x4 | ( | const QGenericMatrix< N, M, qreal > & | matrix | ) | `[explicit]`

Definition at line 230 of file qmatrix4x4.h.

    {
        const qreal *values = matrix.constData();
        for (int matrixCol = 0; matrixCol < 4; ++matrixCol) {
            for (int matrixRow = 0; matrixRow < 4; ++matrixRow) {
                if (matrixCol < N && matrixRow < M)
                    m[matrixCol][matrixRow] = values[matrixCol * M + matrixRow];
                else if (matrixCol == matrixRow)
                    m[matrixCol][matrixRow] = 1.0f;
                else
                    m[matrixCol][matrixRow] = 0.0f;
            }
        }
        flagBits = General;
    }

QMatrix4x4 | ( | const qreal * | values,
|  | int | cols,
|  | int | rows
| ) |  |

QMatrix4x4 | ( | const QTransform & | transform | ) |

QMatrix4x4 | ( | const QMatrix & | matrix | ) |

## Member Function Documentation

const qreal & operator() | ( | int | row,
|  | int | column
| ) |  | const `[inline]`

Definition at line 266 of file qmatrix4x4.h.

    {
        Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
        return m[aColumn][aRow];
    }

qreal & operator() | ( | int | row,
|  | int | column
| ) |  | `[inline]`

Definition at line 272 of file qmatrix4x4.h.

    {
        Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
        flagBits = General;
        return m[aColumn][aRow];
    }

QVector4D column | ( | int | index | ) | const `[inline]`

Search for all occurrences

Definition at line 279 of file qmatrix4x4.h.

    {
        Q_ASSERT(index >= 0 && index < 4);
        return QVector4D(m[index][0], m[index][1], m[index][2], m[index][3]);
    }

void setColumn | ( | int | index,
|  | const QVector4D & | value
| ) |  | `[inline]`

Search for all occurrences

Definition at line 285 of file qmatrix4x4.h.

    {
        Q_ASSERT(index >= 0 && index < 4);
        m[index][0] = value.x();
        m[index][1] = value.y();
        m[index][2] = value.z();
        m[index][3] = value.w();
        flagBits = General;
    }

QVector4D row | ( | int | index | ) | const `[inline]`

Search for all occurrences

Definition at line 295 of file qmatrix4x4.h.

    {
        Q_ASSERT(index >= 0 && index < 4);
        return QVector4D(m[0][index], m[1][index], m[2][index], m[3][index]);
    }

void setRow | ( | int | index,
|  | const QVector4D & | value
| ) |  | `[inline]`

Search for all occurrences

Definition at line 301 of file qmatrix4x4.h.

    {
        Q_ASSERT(index >= 0 && index < 4);
        m[0][index] = value.x();
        m[1][index] = value.y();
        m[2][index] = value.z();
        m[3][index] = value.w();
        flagBits = General;
    }

bool isIdentity | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 313 of file qmatrix4x4.h.

    {
        if (flagBits == Identity)
            return true;
        if (m[0][0] != 1.0f || m[0][1] != 0.0f || m[0][2] != 0.0f)
            return false;
        if (m[0][3] != 0.0f || m[1][0] != 0.0f || m[1][1] != 1.0f)
            return false;
        if (m[1][2] != 0.0f || m[1][3] != 0.0f || m[2][0] != 0.0f)
            return false;
        if (m[2][1] != 0.0f || m[2][2] != 1.0f || m[2][3] != 0.0f)
            return false;
        if (m[3][0] != 0.0f || m[3][1] != 0.0f || m[3][2] != 0.0f)
            return false;
        return (m[3][3] == 1.0f);
    }

void setToIdentity | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 330 of file qmatrix4x4.h.

    {
        m[0][0] = 1.0f;
        m[0][1] = 0.0f;
        m[0][2] = 0.0f;
        m[0][3] = 0.0f;
        m[1][0] = 0.0f;
        m[1][1] = 1.0f;
        m[1][2] = 0.0f;
        m[1][3] = 0.0f;
        m[2][0] = 0.0f;
        m[2][1] = 0.0f;
        m[2][2] = 1.0f;
        m[2][3] = 0.0f;
        m[3][0] = 0.0f;
        m[3][1] = 0.0f;
        m[3][2] = 0.0f;
        m[3][3] = 1.0f;
        flagBits = Identity;
    }

void fill | ( | qreal | value | ) | `[inline]`

Search for all occurrences

Definition at line 351 of file qmatrix4x4.h.

    {
        m[0][0] = value;
        m[0][1] = value;
        m[0][2] = value;
        m[0][3] = value;
        m[1][0] = value;
        m[1][1] = value;
        m[1][2] = value;
        m[1][3] = value;
        m[2][0] = value;
        m[2][1] = value;
        m[2][2] = value;
        m[2][3] = value;
        m[3][0] = value;
        m[3][1] = value;
        m[3][2] = value;
        m[3][3] = value;
        flagBits = General;
    }

qreal determinant | ( |  | ) | const

Search for all occurrences

QMatrix4x4 inverted | ( | bool * | invertible = `0` | ) | const

Search for all occurrences

QMatrix4x4 transposed | ( |  | ) | const

Search for all occurrences

QMatrix3x3 normalMatrix | ( |  | ) | const

Search for all occurrences

QMatrix4x4 & operator+= | ( | const QMatrix4x4 & | other | ) | `[inline]`

Definition at line 372 of file qmatrix4x4.h.

    {
        m[0][0] += other.m[0][0];
        m[0][1] += other.m[0][1];
        m[0][2] += other.m[0][2];
        m[0][3] += other.m[0][3];
        m[1][0] += other.m[1][0];
        m[1][1] += other.m[1][1];
        m[1][2] += other.m[1][2];
        m[1][3] += other.m[1][3];
        m[2][0] += other.m[2][0];
        m[2][1] += other.m[2][1];
        m[2][2] += other.m[2][2];
        m[2][3] += other.m[2][3];
        m[3][0] += other.m[3][0];
        m[3][1] += other.m[3][1];
        m[3][2] += other.m[3][2];
        m[3][3] += other.m[3][3];
        flagBits = General;
        return *this;
    }

QMatrix4x4 & operator-= | ( | const QMatrix4x4 & | other | ) | `[inline]`

Definition at line 394 of file qmatrix4x4.h.

    {
        m[0][0] -= other.m[0][0];
        m[0][1] -= other.m[0][1];
        m[0][2] -= other.m[0][2];
        m[0][3] -= other.m[0][3];
        m[1][0] -= other.m[1][0];
        m[1][1] -= other.m[1][1];
        m[1][2] -= other.m[1][2];
        m[1][3] -= other.m[1][3];
        m[2][0] -= other.m[2][0];
        m[2][1] -= other.m[2][1];
        m[2][2] -= other.m[2][2];
        m[2][3] -= other.m[2][3];
        m[3][0] -= other.m[3][0];
        m[3][1] -= other.m[3][1];
        m[3][2] -= other.m[3][2];
        m[3][3] -= other.m[3][3];
        flagBits = General;
        return *this;
    }

QMatrix4x4 & operator*= | ( | const QMatrix4x4 & | other | ) | `[inline]`

Definition at line 416 of file qmatrix4x4.h.

    {
        if (flagBits == Identity) {
            *this = other;
            return *this;
        } else if (other.flagBits == Identity) {
            return *this;
        } else {
            *this = *this * other;
            return *this;
        }
    }

QMatrix4x4 & operator*= | ( | qreal | factor | ) | `[inline]`

Definition at line 429 of file qmatrix4x4.h.

    {
        m[0][0] *= factor;
        m[0][1] *= factor;
        m[0][2] *= factor;
        m[0][3] *= factor;
        m[1][0] *= factor;
        m[1][1] *= factor;
        m[1][2] *= factor;
        m[1][3] *= factor;
        m[2][0] *= factor;
        m[2][1] *= factor;
        m[2][2] *= factor;
        m[2][3] *= factor;
        m[3][0] *= factor;
        m[3][1] *= factor;
        m[3][2] *= factor;
        m[3][3] *= factor;
        flagBits = General;
        return *this;
    }

QMatrix4x4& operator/= | ( | qreal | divisor | ) |

bool operator== | ( | const QMatrix4x4 & | other | ) | const `[inline]`

Definition at line 451 of file qmatrix4x4.h.

    {
        return m[0][0] == other.m[0][0] &&
               m[0][1] == other.m[0][1] &&
               m[0][2] == other.m[0][2] &&
               m[0][3] == other.m[0][3] &&
               m[1][0] == other.m[1][0] &&
               m[1][1] == other.m[1][1] &&
               m[1][2] == other.m[1][2] &&
               m[1][3] == other.m[1][3] &&
               m[2][0] == other.m[2][0] &&
               m[2][1] == other.m[2][1] &&
               m[2][2] == other.m[2][2] &&
               m[2][3] == other.m[2][3] &&
               m[3][0] == other.m[3][0] &&
               m[3][1] == other.m[3][1] &&
               m[3][2] == other.m[3][2] &&
               m[3][3] == other.m[3][3];
    }

bool operator!= | ( | const QMatrix4x4 & | other | ) | const `[inline]`

Definition at line 471 of file qmatrix4x4.h.

    {
        return m[0][0] != other.m[0][0] ||
               m[0][1] != other.m[0][1] ||
               m[0][2] != other.m[0][2] ||
               m[0][3] != other.m[0][3] ||
               m[1][0] != other.m[1][0] ||
               m[1][1] != other.m[1][1] ||
               m[1][2] != other.m[1][2] ||
               m[1][3] != other.m[1][3] ||
               m[2][0] != other.m[2][0] ||
               m[2][1] != other.m[2][1] ||
               m[2][2] != other.m[2][2] ||
               m[2][3] != other.m[2][3] ||
               m[3][0] != other.m[3][0] ||
               m[3][1] != other.m[3][1] ||
               m[3][2] != other.m[3][2] ||
               m[3][3] != other.m[3][3];
    }

void scale | ( | const QVector3D & | vector | ) |

Search for all occurrences

void translate | ( | const QVector3D & | vector | ) |

Search for all occurrences

void rotate | ( | qreal | angle,
|  | const QVector3D & | vector
| ) |  |

Search for all occurrences

void scale | ( | qreal | x,
|  | qreal | y
| ) |  |

Search for all occurrences

void scale | ( | qreal | x,
|  | qreal | y,
|  | qreal | z
| ) |  |

Search for all occurrences

void scale | ( | qreal | factor | ) |

Search for all occurrences

void translate | ( | qreal | x,
|  | qreal | y
| ) |  |

Search for all occurrences

void translate | ( | qreal | x,
|  | qreal | y,
|  | qreal | z
| ) |  |

Search for all occurrences

void rotate | ( | qreal | angle,
|  | qreal | x,
|  | qreal | y,
|  | qreal | z = `0.0f`
| ) |  |

Search for all occurrences

void rotate | ( | const QQuaternion & | quaternion | ) |

Search for all occurrences

void ortho | ( | const QRect & | rect | ) |

Search for all occurrences

void ortho | ( | const QRectF & | rect | ) |

Search for all occurrences

void ortho | ( | qreal | left,
|  | qreal | right,
|  | qreal | bottom,
|  | qreal | top,
|  | qreal | nearPlane,
|  | qreal | farPlane
| ) |  |

Search for all occurrences

void frustum | ( | qreal | left,
|  | qreal | right,
|  | qreal | bottom,
|  | qreal | top,
|  | qreal | nearPlane,
|  | qreal | farPlane
| ) |  |

Search for all occurrences

void perspective | ( | qreal | angle,
|  | qreal | aspect,
|  | qreal | nearPlane,
|  | qreal | farPlane
| ) |  |

Search for all occurrences

void lookAt | ( | const QVector3D & | eye,
|  | const QVector3D & | center,
|  | const QVector3D & | up
| ) |  |

Search for all occurrences

void flipCoordinates | ( |  | ) |

Search for all occurrences

void copyDataTo | ( | qreal * | values | ) | const

Search for all occurrences

QMatrix toAffine | ( |  | ) | const

Search for all occurrences

QTransform toTransform | ( |  | ) | const

Search for all occurrences

QTransform toTransform | ( | qreal | distanceToPlane | ) | const

Search for all occurrences

QPoint map | ( | const QPoint & | point | ) | const `[inline]`

Search for all occurrences

Definition at line 929 of file qmatrix4x4.h.

    {
        return *this * point;
    }

QPointF map | ( | const QPointF & | point | ) | const `[inline]`

Search for all occurrences

Definition at line 934 of file qmatrix4x4.h.

    {
        return *this * point;
    }

QVector3D map | ( | const QVector3D & | point | ) | const `[inline]`

Search for all occurrences

Definition at line 941 of file qmatrix4x4.h.

    {
        return *this * point;
    }

QVector3D mapVector | ( | const QVector3D & | vector | ) | const `[inline]`

Search for all occurrences

Definition at line 946 of file qmatrix4x4.h.

    {
        if (flagBits == Identity || flagBits == Translation) {
            return vector;
        } else if (flagBits == Scale || flagBits == (Translation | Scale)) {
            return QVector3D(vector.x() * m[0][0],
                             vector.y() * m[1][1],
                             vector.z() * m[2][2]);
        } else {
            return QVector3D(vector.x() * m[0][0] +
                             vector.y() * m[1][0] +
                             vector.z() * m[2][0],
                             vector.x() * m[0][1] +
                             vector.y() * m[1][1] +
                             vector.z() * m[2][1],
                             vector.x() * m[0][2] +
                             vector.y() * m[1][2] +
                             vector.z() * m[2][2]);
        }
    }

QVector4D map | ( | const QVector4D & | point | ) | const `[inline]`

Search for all occurrences

Definition at line 971 of file qmatrix4x4.h.

    {
        return *this * point;
    }

QRect mapRect | ( | const QRect & | rect | ) | const

Search for all occurrences

QRectF mapRect | ( | const QRectF & | rect | ) | const

Search for all occurrences

QGenericMatrix< N, M, qreal > toGenericMatrix | ( |  | ) | const

Search for all occurrences

Definition at line 247 of file qmatrix4x4.h.

    {
        QGenericMatrix<N, M, qreal> result;
        qreal *values = result.data();
        for (int matrixCol = 0; matrixCol < N; ++matrixCol) {
            for (int matrixRow = 0; matrixRow < M; ++matrixRow) {
                if (matrixCol < 4 && matrixRow < 4)
                    values[matrixCol * M + matrixRow] = m[matrixCol][matrixRow];
                else if (matrixCol == matrixRow)
                    values[matrixCol * M + matrixRow] = 1.0f;
                else
                    values[matrixCol * M + matrixRow] = 0.0f;
            }
        }
        return result;
    }

qreal * data | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 978 of file qmatrix4x4.h.

    {
        // We have to assume that the caller will modify the matrix elements,
        // so we flip it over to "General" mode.
        flagBits = General;
        return m[0];
    }

const qreal* data | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 178 of file qmatrix4x4.h.

    { return m[0]; }

const qreal* constData | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 179 of file qmatrix4x4.h.

    { return m[0]; }

void optimize | ( |  | ) |

Search for all occurrences

operator QVariant | ( |  | ) | const

## Friends And Related Function Documentation

friend class QGraphicsRotation `[friend]`

Search for all occurrences

Definition at line 208 of file qmatrix4x4.h.

QMatrix4x4 operator+ | ( | const QMatrix4x4 & | m1,
|  | const QMatrix4x4 & | m2
| ) |  | `[friend]`

Definition at line 491 of file qmatrix4x4.h.

    {
        QMatrix4x4 m(1);
        m.m[0][0] = m1.m[0][0] + m2.m[0][0];
        m.m[0][1] = m1.m[0][1] + m2.m[0][1];
        m.m[0][2] = m1.m[0][2] + m2.m[0][2];
        m.m[0][3] = m1.m[0][3] + m2.m[0][3];
        m.m[1][0] = m1.m[1][0] + m2.m[1][0];
        m.m[1][1] = m1.m[1][1] + m2.m[1][1];
        m.m[1][2] = m1.m[1][2] + m2.m[1][2];
        m.m[1][3] = m1.m[1][3] + m2.m[1][3];
        m.m[2][0] = m1.m[2][0] + m2.m[2][0];
        m.m[2][1] = m1.m[2][1] + m2.m[2][1];
        m.m[2][2] = m1.m[2][2] + m2.m[2][2];
        m.m[2][3] = m1.m[2][3] + m2.m[2][3];
        m.m[3][0] = m1.m[3][0] + m2.m[3][0];
        m.m[3][1] = m1.m[3][1] + m2.m[3][1];
        m.m[3][2] = m1.m[3][2] + m2.m[3][2];
        m.m[3][3] = m1.m[3][3] + m2.m[3][3];
        return m;
    }

QMatrix4x4 operator- | ( | const QMatrix4x4 & | m1,
|  | const QMatrix4x4 & | m2
| ) |  | `[friend]`

Definition at line 513 of file qmatrix4x4.h.

    {
        QMatrix4x4 m(1);
        m.m[0][0] = m1.m[0][0] - m2.m[0][0];
        m.m[0][1] = m1.m[0][1] - m2.m[0][1];
        m.m[0][2] = m1.m[0][2] - m2.m[0][2];
        m.m[0][3] = m1.m[0][3] - m2.m[0][3];
        m.m[1][0] = m1.m[1][0] - m2.m[1][0];
        m.m[1][1] = m1.m[1][1] - m2.m[1][1];
        m.m[1][2] = m1.m[1][2] - m2.m[1][2];
        m.m[1][3] = m1.m[1][3] - m2.m[1][3];
        m.m[2][0] = m1.m[2][0] - m2.m[2][0];
        m.m[2][1] = m1.m[2][1] - m2.m[2][1];
        m.m[2][2] = m1.m[2][2] - m2.m[2][2];
        m.m[2][3] = m1.m[2][3] - m2.m[2][3];
        m.m[3][0] = m1.m[3][0] - m2.m[3][0];
        m.m[3][1] = m1.m[3][1] - m2.m[3][1];
        m.m[3][2] = m1.m[3][2] - m2.m[3][2];
        m.m[3][3] = m1.m[3][3] - m2.m[3][3];
        return m;
    }

QMatrix4x4 operator* | ( | const QMatrix4x4 & | m1,
|  | const QMatrix4x4 & | m2
| ) |  | `[friend]`

Definition at line 535 of file qmatrix4x4.h.

    {
        if (m1.flagBits == QMatrix4x4::Identity)
            return m2;
        else if (m2.flagBits == QMatrix4x4::Identity)
            return m1;

        QMatrix4x4 m(1);
        m.m[0][0] = m1.m[0][0] * m2.m[0][0] +
                    m1.m[1][0] * m2.m[0][1] +
                    m1.m[2][0] * m2.m[0][2] +
                    m1.m[3][0] * m2.m[0][3];
        m.m[0][1] = m1.m[0][1] * m2.m[0][0] +
                    m1.m[1][1] * m2.m[0][1] +
                    m1.m[2][1] * m2.m[0][2] +
                    m1.m[3][1] * m2.m[0][3];
        m.m[0][2] = m1.m[0][2] * m2.m[0][0] +
                    m1.m[1][2] * m2.m[0][1] +
                    m1.m[2][2] * m2.m[0][2] +
                    m1.m[3][2] * m2.m[0][3];
        m.m[0][3] = m1.m[0][3] * m2.m[0][0] +
                    m1.m[1][3] * m2.m[0][1] +
                    m1.m[2][3] * m2.m[0][2] +
                    m1.m[3][3] * m2.m[0][3];
        m.m[1][0] = m1.m[0][0] * m2.m[1][0] +
                    m1.m[1][0] * m2.m[1][1] +
                    m1.m[2][0] * m2.m[1][2] +
                    m1.m[3][0] * m2.m[1][3];
        m.m[1][1] = m1.m[0][1] * m2.m[1][0] +
                    m1.m[1][1] * m2.m[1][1] +
                    m1.m[2][1] * m2.m[1][2] +
                    m1.m[3][1] * m2.m[1][3];
        m.m[1][2] = m1.m[0][2] * m2.m[1][0] +
                    m1.m[1][2] * m2.m[1][1] +
                    m1.m[2][2] * m2.m[1][2] +
                    m1.m[3][2] * m2.m[1][3];
        m.m[1][3] = m1.m[0][3] * m2.m[1][0] +
                    m1.m[1][3] * m2.m[1][1] +
                    m1.m[2][3] * m2.m[1][2] +
                    m1.m[3][3] * m2.m[1][3];
        m.m[2][0] = m1.m[0][0] * m2.m[2][0] +
                    m1.m[1][0] * m2.m[2][1] +
                    m1.m[2][0] * m2.m[2][2] +
                    m1.m[3][0] * m2.m[2][3];
        m.m[2][1] = m1.m[0][1] * m2.m[2][0] +
                    m1.m[1][1] * m2.m[2][1] +
                    m1.m[2][1] * m2.m[2][2] +
                    m1.m[3][1] * m2.m[2][3];
        m.m[2][2] = m1.m[0][2] * m2.m[2][0] +
                    m1.m[1][2] * m2.m[2][1] +
                    m1.m[2][2] * m2.m[2][2] +
                    m1.m[3][2] * m2.m[2][3];
        m.m[2][3] = m1.m[0][3] * m2.m[2][0] +
                    m1.m[1][3] * m2.m[2][1] +
                    m1.m[2][3] * m2.m[2][2] +
                    m1.m[3][3] * m2.m[2][3];
        m.m[3][0] = m1.m[0][0] * m2.m[3][0] +
                    m1.m[1][0] * m2.m[3][1] +
                    m1.m[2][0] * m2.m[3][2] +
                    m1.m[3][0] * m2.m[3][3];
        m.m[3][1] = m1.m[0][1] * m2.m[3][0] +
                    m1.m[1][1] * m2.m[3][1] +
                    m1.m[2][1] * m2.m[3][2] +
                    m1.m[3][1] * m2.m[3][3];
        m.m[3][2] = m1.m[0][2] * m2.m[3][0] +
                    m1.m[1][2] * m2.m[3][1] +
                    m1.m[2][2] * m2.m[3][2] +
                    m1.m[3][2] * m2.m[3][3];
        m.m[3][3] = m1.m[0][3] * m2.m[3][0] +
                    m1.m[1][3] * m2.m[3][1] +
                    m1.m[2][3] * m2.m[3][2] +
                    m1.m[3][3] * m2.m[3][3];
        return m;
    }

QVector3D operator* | ( | const QMatrix4x4 & | matrix,
|  | const QVector3D & | vector
| ) |  | `[friend]`

Definition at line 637 of file qmatrix4x4.h.

    {
        qreal x, y, z, w;
        if (matrix.flagBits == QMatrix4x4::Identity) {
            return vector;
        } else if (matrix.flagBits == QMatrix4x4::Translation) {
            return QVector3D(vector.x() + matrix.m[3][0],
                             vector.y() + matrix.m[3][1],
                             vector.z() + matrix.m[3][2]);
        } else if (matrix.flagBits ==
                        (QMatrix4x4::Translation | QMatrix4x4::Scale)) {
            return QVector3D(vector.x() * matrix.m[0][0] + matrix.m[3][0],
                             vector.y() * matrix.m[1][1] + matrix.m[3][1],
                             vector.z() * matrix.m[2][2] + matrix.m[3][2]);
        } else if (matrix.flagBits == QMatrix4x4::Scale) {
            return QVector3D(vector.x() * matrix.m[0][0],
                             vector.y() * matrix.m[1][1],
                             vector.z() * matrix.m[2][2]);
        } else {
            x = vector.x() * matrix.m[0][0] +
                vector.y() * matrix.m[1][0] +
                vector.z() * matrix.m[2][0] +
                matrix.m[3][0];
            y = vector.x() * matrix.m[0][1] +
                vector.y() * matrix.m[1][1] +
                vector.z() * matrix.m[2][1] +
                matrix.m[3][1];
            z = vector.x() * matrix.m[0][2] +
                vector.y() * matrix.m[1][2] +
                vector.z() * matrix.m[2][2] +
                matrix.m[3][2];
            w = vector.x() * matrix.m[0][3] +
                vector.y() * matrix.m[1][3] +
                vector.z() * matrix.m[2][3] +
                matrix.m[3][3];
            if (w == 1.0f)
                return QVector3D(x, y, z);
            else
                return QVector3D(x / w, y / w, z / w);
        }
    }

QVector3D operator* | ( | const QVector3D & | vector,
|  | const QMatrix4x4 & | matrix
| ) |  | `[friend]`

Definition at line 612 of file qmatrix4x4.h.

    {
        qreal x, y, z, w;
        x = vector.x() * matrix.m[0][0] +
            vector.y() * matrix.m[0][1] +
            vector.z() * matrix.m[0][2] +
            matrix.m[0][3];
        y = vector.x() * matrix.m[1][0] +
            vector.y() * matrix.m[1][1] +
            vector.z() * matrix.m[1][2] +
            matrix.m[1][3];
        z = vector.x() * matrix.m[2][0] +
            vector.y() * matrix.m[2][1] +
            vector.z() * matrix.m[2][2] +
            matrix.m[2][3];
        w = vector.x() * matrix.m[3][0] +
            vector.y() * matrix.m[3][1] +
            vector.z() * matrix.m[3][2] +
            matrix.m[3][3];
        if (w == 1.0f)
            return QVector3D(x, y, z);
        else
            return QVector3D(x / w, y / w, z / w);
    }

QVector4D operator* | ( | const QVector4D & | vector,
|  | const QMatrix4x4 & | matrix
| ) |  | `[friend]`

Definition at line 683 of file qmatrix4x4.h.

    {
        qreal x, y, z, w;
        x = vector.x() * matrix.m[0][0] +
            vector.y() * matrix.m[0][1] +
            vector.z() * matrix.m[0][2] +
            vector.w() * matrix.m[0][3];
        y = vector.x() * matrix.m[1][0] +
            vector.y() * matrix.m[1][1] +
            vector.z() * matrix.m[1][2] +
            vector.w() * matrix.m[1][3];
        z = vector.x() * matrix.m[2][0] +
            vector.y() * matrix.m[2][1] +
            vector.z() * matrix.m[2][2] +
            vector.w() * matrix.m[2][3];
        w = vector.x() * matrix.m[3][0] +
            vector.y() * matrix.m[3][1] +
            vector.z() * matrix.m[3][2] +
            vector.w() * matrix.m[3][3];
        return QVector4D(x, y, z, w);
    }

QVector4D operator* | ( | const QMatrix4x4 & | matrix,
|  | const QVector4D & | vector
| ) |  | `[friend]`

Definition at line 705 of file qmatrix4x4.h.

    {
        qreal x, y, z, w;
        x = vector.x() * matrix.m[0][0] +
            vector.y() * matrix.m[1][0] +
            vector.z() * matrix.m[2][0] +
            vector.w() * matrix.m[3][0];
        y = vector.x() * matrix.m[0][1] +
            vector.y() * matrix.m[1][1] +
            vector.z() * matrix.m[2][1] +
            vector.w() * matrix.m[3][1];
        z = vector.x() * matrix.m[0][2] +
            vector.y() * matrix.m[1][2] +
            vector.z() * matrix.m[2][2] +
            vector.w() * matrix.m[3][2];
        w = vector.x() * matrix.m[0][3] +
            vector.y() * matrix.m[1][3] +
            vector.z() * matrix.m[2][3] +
            vector.w() * matrix.m[3][3];
        return QVector4D(x, y, z, w);
    }

QPoint operator* | ( | const QPoint & | point,
|  | const QMatrix4x4 & | matrix
| ) |  | `[friend]`

Definition at line 729 of file qmatrix4x4.h.

    {
        qreal xin, yin;
        qreal x, y, w;
        xin = point.x();
        yin = point.y();
        x = xin * matrix.m[0][0] +
            yin * matrix.m[0][1] +
            matrix.m[0][3];
        y = xin * matrix.m[1][0] +
            yin * matrix.m[1][1] +
            matrix.m[1][3];
        w = xin * matrix.m[3][0] +
            yin * matrix.m[3][1] +
            matrix.m[3][3];
        if (w == 1.0f)
            return QPoint(qRound(x), qRound(y));
        else
            return QPoint(qRound(x / w), qRound(y / w));
    }

QPointF operator* | ( | const QPointF & | point,
|  | const QMatrix4x4 & | matrix
| ) |  | `[friend]`

Definition at line 750 of file qmatrix4x4.h.

    {
        qreal xin, yin;
        qreal x, y, w;
        xin = point.x();
        yin = point.y();
        x = xin * matrix.m[0][0] +
            yin * matrix.m[0][1] +
            matrix.m[0][3];
        y = xin * matrix.m[1][0] +
            yin * matrix.m[1][1] +
            matrix.m[1][3];
        w = xin * matrix.m[3][0] +
            yin * matrix.m[3][1] +
            matrix.m[3][3];
        if (w == 1.0f) {
            return QPointF(qreal(x), qreal(y));
        } else {
            return QPointF(qreal(x / w), qreal(y / w));
        }
    }

QMatrix4x4 operator- | ( | const QMatrix4x4 & | matrix | ) | `[friend]`

Definition at line 843 of file qmatrix4x4.h.

    {
        QMatrix4x4 m(1);
        m.m[0][0] = -matrix.m[0][0];
        m.m[0][1] = -matrix.m[0][1];
        m.m[0][2] = -matrix.m[0][2];
        m.m[0][3] = -matrix.m[0][3];
        m.m[1][0] = -matrix.m[1][0];
        m.m[1][1] = -matrix.m[1][1];
        m.m[1][2] = -matrix.m[1][2];
        m.m[1][3] = -matrix.m[1][3];
        m.m[2][0] = -matrix.m[2][0];
        m.m[2][1] = -matrix.m[2][1];
        m.m[2][2] = -matrix.m[2][2];
        m.m[2][3] = -matrix.m[2][3];
        m.m[3][0] = -matrix.m[3][0];
        m.m[3][1] = -matrix.m[3][1];
        m.m[3][2] = -matrix.m[3][2];
        m.m[3][3] = -matrix.m[3][3];
        return m;
    }

QPoint operator* | ( | const QMatrix4x4 & | matrix,
|  | const QPoint & | point
| ) |  | `[friend]`

Definition at line 772 of file qmatrix4x4.h.

    {
        qreal xin, yin;
        qreal x, y, w;
        xin = point.x();
        yin = point.y();
        if (matrix.flagBits == QMatrix4x4::Identity) {
            return point;
        } else if (matrix.flagBits == QMatrix4x4::Translation) {
            return QPoint(qRound(xin + matrix.m[3][0]),
                          qRound(yin + matrix.m[3][1]));
        } else if (matrix.flagBits ==
                        (QMatrix4x4::Translation | QMatrix4x4::Scale)) {
            return QPoint(qRound(xin * matrix.m[0][0] + matrix.m[3][0]),
                          qRound(yin * matrix.m[1][1] + matrix.m[3][1]));
        } else if (matrix.flagBits == QMatrix4x4::Scale) {
            return QPoint(qRound(xin * matrix.m[0][0]),
                          qRound(yin * matrix.m[1][1]));
        } else {
            x = xin * matrix.m[0][0] +
                yin * matrix.m[1][0] +
                matrix.m[3][0];
            y = xin * matrix.m[0][1] +
                yin * matrix.m[1][1] +
                matrix.m[3][1];
            w = xin * matrix.m[0][3] +
                yin * matrix.m[1][3] +
                matrix.m[3][3];
            if (w == 1.0f)
                return QPoint(qRound(x), qRound(y));
            else
                return QPoint(qRound(x / w), qRound(y / w));
        }
    }

QPointF operator* | ( | const QMatrix4x4 & | matrix,
|  | const QPointF & | point
| ) |  | `[friend]`

Definition at line 807 of file qmatrix4x4.h.

    {
        qreal xin, yin;
        qreal x, y, w;
        xin = point.x();
        yin = point.y();
        if (matrix.flagBits == QMatrix4x4::Identity) {
            return point;
        } else if (matrix.flagBits == QMatrix4x4::Translation) {
            return QPointF(xin + matrix.m[3][0],
                           yin + matrix.m[3][1]);
        } else if (matrix.flagBits ==
                        (QMatrix4x4::Translation | QMatrix4x4::Scale)) {
            return QPointF(xin * matrix.m[0][0] + matrix.m[3][0],
                           yin * matrix.m[1][1] + matrix.m[3][1]);
        } else if (matrix.flagBits == QMatrix4x4::Scale) {
            return QPointF(xin * matrix.m[0][0],
                           yin * matrix.m[1][1]);
        } else {
            x = xin * matrix.m[0][0] +
                yin * matrix.m[1][0] +
                matrix.m[3][0];
            y = xin * matrix.m[0][1] +
                yin * matrix.m[1][1] +
                matrix.m[3][1];
            w = xin * matrix.m[0][3] +
                yin * matrix.m[1][3] +
                matrix.m[3][3];
            if (w == 1.0f) {
                return QPointF(qreal(x), qreal(y));
            } else {
                return QPointF(qreal(x / w), qreal(y / w));
            }
        }
    }

QMatrix4x4 operator* | ( | qreal | factor,
|  | const QMatrix4x4 & | matrix
| ) |  | `[friend]`

Definition at line 865 of file qmatrix4x4.h.

    {
        QMatrix4x4 m(1);
        m.m[0][0] = matrix.m[0][0] * factor;
        m.m[0][1] = matrix.m[0][1] * factor;
        m.m[0][2] = matrix.m[0][2] * factor;
        m.m[0][3] = matrix.m[0][3] * factor;
        m.m[1][0] = matrix.m[1][0] * factor;
        m.m[1][1] = matrix.m[1][1] * factor;
        m.m[1][2] = matrix.m[1][2] * factor;
        m.m[1][3] = matrix.m[1][3] * factor;
        m.m[2][0] = matrix.m[2][0] * factor;
        m.m[2][1] = matrix.m[2][1] * factor;
        m.m[2][2] = matrix.m[2][2] * factor;
        m.m[2][3] = matrix.m[2][3] * factor;
        m.m[3][0] = matrix.m[3][0] * factor;
        m.m[3][1] = matrix.m[3][1] * factor;
        m.m[3][2] = matrix.m[3][2] * factor;
        m.m[3][3] = matrix.m[3][3] * factor;
        return m;
    }

QMatrix4x4 operator* | ( | const QMatrix4x4 & | matrix,
|  | qreal | factor
| ) |  | `[friend]`

Definition at line 887 of file qmatrix4x4.h.

    {
        QMatrix4x4 m(1);
        m.m[0][0] = matrix.m[0][0] * factor;
        m.m[0][1] = matrix.m[0][1] * factor;
        m.m[0][2] = matrix.m[0][2] * factor;
        m.m[0][3] = matrix.m[0][3] * factor;
        m.m[1][0] = matrix.m[1][0] * factor;
        m.m[1][1] = matrix.m[1][1] * factor;
        m.m[1][2] = matrix.m[1][2] * factor;
        m.m[1][3] = matrix.m[1][3] * factor;
        m.m[2][0] = matrix.m[2][0] * factor;
        m.m[2][1] = matrix.m[2][1] * factor;
        m.m[2][2] = matrix.m[2][2] * factor;
        m.m[2][3] = matrix.m[2][3] * factor;
        m.m[3][0] = matrix.m[3][0] * factor;
        m.m[3][1] = matrix.m[3][1] * factor;
        m.m[3][2] = matrix.m[3][2] * factor;
        m.m[3][3] = matrix.m[3][3] * factor;
        return m;
    }

Q_GUI_EXPORT QMatrix4x4 operator/ | ( | const QMatrix4x4 & | matrix,
|  | qreal | divisor
| ) |  | `[friend]`

bool qFuzzyCompare | ( | const QMatrix4x4 & | m1,
|  | const QMatrix4x4 & | m2
| ) |  | `[friend]`

Search for all occurrences

Definition at line 909 of file qmatrix4x4.h.

    {
        return qFuzzyCompare(m1.m[0][0], m2.m[0][0]) &&
               qFuzzyCompare(m1.m[0][1], m2.m[0][1]) &&
               qFuzzyCompare(m1.m[0][2], m2.m[0][2]) &&
               qFuzzyCompare(m1.m[0][3], m2.m[0][3]) &&
               qFuzzyCompare(m1.m[1][0], m2.m[1][0]) &&
               qFuzzyCompare(m1.m[1][1], m2.m[1][1]) &&
               qFuzzyCompare(m1.m[1][2], m2.m[1][2]) &&
               qFuzzyCompare(m1.m[1][3], m2.m[1][3]) &&
               qFuzzyCompare(m1.m[2][0], m2.m[2][0]) &&
               qFuzzyCompare(m1.m[2][1], m2.m[2][1]) &&
               qFuzzyCompare(m1.m[2][2], m2.m[2][2]) &&
               qFuzzyCompare(m1.m[2][3], m2.m[2][3]) &&
               qFuzzyCompare(m1.m[3][0], m2.m[3][0]) &&
               qFuzzyCompare(m1.m[3][1], m2.m[3][1]) &&
               qFuzzyCompare(m1.m[3][2], m2.m[3][2]) &&
               qFuzzyCompare(m1.m[3][3], m2.m[3][3]);
    }

Q_GUI_EXPORT QDebug operator<< | ( | QDebug | dbg,
|  | const QMatrix4x4 & | m
| ) |  | `[friend]`

The documentation for this class was generated from the following file:

- QtGui/qmatrix4x4.h

QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4
QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4 QMatrix4x4