Qt 4.8
|
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space. More...
#include <qmatrix4x4.h>
Public Functions | |
QVector4D | column (int index) const |
Returns the elements of column index as a 4D vector. More... | |
const qreal * | constData () const |
Returns a constant pointer to the raw data of this matrix. More... | |
void | copyDataTo (qreal *values) const |
Retrieves the 16 items in this matrix and copies them to values in row-major order. More... | |
qreal * | data () |
Returns a pointer to the raw data of this matrix. More... | |
const qreal * | data () const |
Returns a constant pointer to the raw data of this matrix. More... | |
qreal | determinant () const |
Returns the determinant of this matrix. More... | |
void | fill (qreal value) |
Fills all elements of this matrx with value. More... | |
void | flipCoordinates () |
Flips between right-handed and left-handed coordinate systems by multiplying the y and z co-ordinates by -1. More... | |
void | frustum (qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) |
Multiplies this matrix by another that applies a perspective frustum projection for a window with lower-left corner (left, bottom), upper-right corner (right, top), and the specified nearPlane and farPlane clipping planes. More... | |
QMatrix4x4 | inverted (bool *invertible=0) const |
Returns the inverse of this matrix. More... | |
bool | isIdentity () const |
Returns true if this matrix is the identity; false otherwise. More... | |
void | lookAt (const QVector3D &eye, const QVector3D ¢er, const QVector3D &up) |
Multiplies this matrix by another that applies an eye position transformation. More... | |
QPoint | map (const QPoint &point) const |
Maps point by multiplying this matrix by point. More... | |
QPointF | map (const QPointF &point) const |
Maps point by multiplying this matrix by point. More... | |
QVector3D | map (const QVector3D &point) const |
Maps point by multiplying this matrix by point. More... | |
QVector4D | map (const QVector4D &point) const |
Maps point by multiplying this matrix by point. More... | |
QRect | mapRect (const QRect &rect) const |
Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the results. More... | |
QRectF | mapRect (const QRectF &rect) const |
Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the results. More... | |
QVector3D | mapVector (const QVector3D &vector) const |
Maps vector by multiplying the top 3x3 portion of this matrix by vector. More... | |
QMatrix3x3 | normalMatrix () const |
Returns the normal matrix corresponding to this 4x4 transformation. More... | |
operator QVariant () const | |
Returns the matrix as a QVariant. More... | |
bool | operator!= (const QMatrix4x4 &other) const |
Returns true if this matrix is not identical to other; false otherwise. More... | |
const qreal & | operator() (int row, int column) const |
Returns a constant reference to the element at position (row, column) in this matrix. More... | |
qreal & | 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. More... | |
QMatrix4x4 & | operator*= (const QMatrix4x4 &other) |
Multiplies the contents of other by this matrix. More... | |
QMatrix4x4 & | operator*= (qreal factor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies all elements of this matrix by factor. More... | |
QMatrix4x4 & | operator+= (const QMatrix4x4 &other) |
Adds the contents of other to this matrix. More... | |
QMatrix4x4 & | operator-= (const QMatrix4x4 &other) |
Subtracts the contents of other from this matrix. More... | |
QMatrix4x4 & | operator/= (qreal divisor) |
Divides all elements of this matrix by divisor. More... | |
bool | operator== (const QMatrix4x4 &other) const |
Returns true if this matrix is identical to other; false otherwise. More... | |
void | optimize () |
Optimize the usage of this matrix from its current elements. More... | |
void | ortho (const QRect &rect) |
Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by rect. More... | |
void | ortho (const QRectF &rect) |
Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by rect. More... | |
void | ortho (qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) |
Multiplies this matrix by another that applies an orthographic projection for a window with lower-left corner (left, bottom), upper-right corner (right, top), and the specified nearPlane and farPlane clipping planes. More... | |
void | perspective (qreal angle, qreal aspect, qreal nearPlane, qreal farPlane) |
Multiplies this matrix by another that applies a perspective projection. More... | |
QMatrix4x4 () | |
Constructs an identity matrix. More... | |
QMatrix4x4 (const qreal *values) | |
Constructs a matrix from the given 16 floating-point values. More... | |
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) | |
Constructs a matrix from the 16 elements m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, and m44. More... | |
template<int N, int M> | |
QMatrix4x4 (const QGenericMatrix< N, M, qreal > &matrix) | |
Constructs a 4x4 matrix from the left-most 4 columns and top-most 4 rows of matrix. More... | |
QMatrix4x4 (const qreal *values, int cols, int rows) | |
QMatrix4x4 (const QTransform &transform) | |
Constructs a 4x4 matrix from the conventional Qt 2D transformation matrix transform. More... | |
QMatrix4x4 (const QMatrix &matrix) | |
Constructs a 4x4 matrix from a conventional Qt 2D affine transformation matrix. More... | |
template<int N, int M> | |
Q_INLINE_TEMPLATE | QMatrix4x4 (const QGenericMatrix< N, M, qreal > &matrix) |
void | rotate (qreal angle, const QVector3D &vector) |
Multiples this matrix by another that rotates coordinates through angle degrees about vector. More... | |
void | rotate (qreal angle, qreal x, qreal y, qreal z=0.0f) |
Multiplies this matrix by another that rotates coordinates through angle degrees about the vector (x, y, z). More... | |
void | rotate (const QQuaternion &quaternion) |
Multiples this matrix by another that rotates coordinates according to a specified quaternion. More... | |
QVector4D | row (int index) const |
Returns the elements of row index as a 4D vector. More... | |
void | scale (const QVector3D &vector) |
Multiplies this matrix by another that scales coordinates by the components of vector. More... | |
void | scale (qreal x, qreal y) |
Multiplies this matrix by another that scales coordinates by the components x, and y. More... | |
void | scale (qreal x, qreal y, qreal z) |
Multiplies this matrix by another that scales coordinates by the components x, y, and z. More... | |
void | scale (qreal factor) |
Multiplies this matrix by another that scales coordinates by the given factor. More... | |
void | setColumn (int index, const QVector4D &value) |
Sets the elements of column index to the components of value. More... | |
void | setRow (int index, const QVector4D &value) |
Sets the elements of row index to the components of value. More... | |
void | setToIdentity () |
Sets this matrix to the identity. More... | |
QMatrix | toAffine () const |
Returns the conventional Qt 2D affine transformation matrix that corresponds to this matrix. More... | |
template<int N, int M> | |
QGenericMatrix< N, M, qreal > | toGenericMatrix () const |
Constructs a NxM generic matrix from the left-most N columns and top-most M rows of this 4x4 matrix. More... | |
QTransform | toTransform () const |
Returns the conventional Qt 2D transformation matrix that corresponds to this matrix. More... | |
QTransform | toTransform (qreal distanceToPlane) const |
Returns the conventional Qt 2D transformation matrix that corresponds to this matrix. More... | |
void | translate (const QVector3D &vector) |
Multiplies this matrix by another that translates coordinates by the components of vector. More... | |
void | translate (qreal x, qreal y) |
Multiplies this matrix by another that translates coordinates by the components x, and y. More... | |
void | translate (qreal x, qreal y, qreal z) |
Multiplies this matrix by another that translates coordinates by the components x, y, and z. More... | |
QMatrix4x4 | transposed () const |
Returns this matrix, transposed about its diagonal. More... | |
Private Types | |
enum | { Identity = 0x0001, General = 0x0002, Translation = 0x0004, Scale = 0x0008, Rotation = 0x0010 } |
Private Functions | |
QMatrix4x4 | orthonormalInverse () const |
void | projectedRotate (qreal angle, qreal x, qreal y, qreal z) |
QMatrix4x4 (int) | |
Properties | |
int | flagBits |
qreal | m [4][4] |
Friends | |
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) |
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) |
QMatrix4x4 | operator+ (const QMatrix4x4 &m1, const QMatrix4x4 &m2) |
Returns the sum of m1 and m2. More... | |
QMatrix4x4 | operator- (const QMatrix4x4 &m1, const QMatrix4x4 &m2) |
Returns the difference of m1 and m2. More... | |
QMatrix4x4 | operator- (const QMatrix4x4 &matrix) |
Returns the negation of matrix. More... | |
Q_GUI_EXPORT QMatrix4x4 | operator/ (const QMatrix4x4 &matrix, qreal divisor) |
Returns the result of dividing all elements of matrix by divisor. More... | |
Q_GUI_EXPORT QDebug | operator<< (QDebug dbg, const QMatrix4x4 &m) |
bool | qFuzzyCompare (const QMatrix4x4 &m1, const QMatrix4x4 &m2) |
Returns true if m1 and m2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise. More... | |
class | QGraphicsRotation |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &stream, const QMatrix4x4 &matrix) |
Writes the given matrix to the given stream and returns a reference to the stream. More... | |
QDataStream & | operator>> (QDataStream &stream, QMatrix4x4 &matrix) |
Reads a 4x4 matrix from the given stream into the given matrix and returns a reference to the stream. More... | |
QGenericMatrix< N, M, qreal > | qGenericMatrixFromMatrix4x4 (const QMatrix4x4 &matrix) |
Returns a NxM generic matrix constructed from the left-most N columns and top-most M rows of matrix. More... | |
QMatrix4x4 | qGenericMatrixToMatrix4x4 (const QGenericMatrix< N, M, qreal > &matrix) |
Returns a 4x4 matrix constructed from the left-most 4 columns and top-most 4 rows of matrix. More... | |
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition at line 63 of file qmatrix4x4.h.
|
private |
Enumerator | |
---|---|
Identity | |
General | |
Translation | |
Scale | |
Rotation |
Definition at line 191 of file qmatrix4x4.h.
|
inline |
Constructs an identity matrix.
Definition at line 66 of file qmatrix4x4.h.
Referenced by inverted(), and QMatrix4x4().
|
explicit |
Constructs a matrix from the given 16 floating-point values.
The contents of the array values is assumed to be in row-major order.
If the matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc.
Definition at line 87 of file qmatrix4x4.cpp.
|
inline |
Constructs a matrix from the 16 elements m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, and m44.
The elements are specified in row-major order.
If the matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc.
Definition at line 212 of file qmatrix4x4.h.
|
explicit |
Constructs a 4x4 matrix from the left-most 4 columns and top-most 4 rows of matrix.
If matrix has less than 4 columns or rows, the remaining elements are filled with elements from the identity matrix.
QMatrix4x4::QMatrix4x4 | ( | const qreal * | values, |
int | cols, | ||
int | rows | ||
) |
Definition at line 175 of file qmatrix4x4.cpp.
QMatrix4x4::QMatrix4x4 | ( | const QTransform & | transform | ) |
Constructs a 4x4 matrix from the conventional Qt 2D transformation matrix transform.
If transform has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc.
Definition at line 233 of file qmatrix4x4.cpp.
QMatrix4x4::QMatrix4x4 | ( | const QMatrix & | matrix | ) |
Constructs a 4x4 matrix from a conventional Qt 2D affine transformation matrix.
If matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc.
Definition at line 201 of file qmatrix4x4.cpp.
|
inlineprivate |
Definition at line 200 of file qmatrix4x4.h.
Q_INLINE_TEMPLATE QMatrix4x4::QMatrix4x4 | ( | const QGenericMatrix< N, M, qreal > & | matrix | ) |
Definition at line 226 of file qmatrix4x4.h.
|
inline |
Returns the elements of column index as a 4D vector.
Definition at line 273 of file qmatrix4x4.h.
|
inline |
Returns a constant pointer to the raw data of this matrix.
Definition at line 177 of file qmatrix4x4.h.
Referenced by qGenericMatrixFromMatrix4x4().
void QMatrix4x4::copyDataTo | ( | qreal * | values | ) | const |
Retrieves the 16 items in this matrix and copies them to values in row-major order.
Definition at line 1599 of file qmatrix4x4.cpp.
|
inline |
Returns a pointer to the raw data of this matrix.
Definition at line 972 of file qmatrix4x4.h.
|
inline |
Returns a constant pointer to the raw data of this matrix.
Definition at line 176 of file qmatrix4x4.h.
qreal QMatrix4x4::determinant | ( | ) | const |
|
inline |
Fills all elements of this matrx with value.
Definition at line 345 of file qmatrix4x4.h.
void QMatrix4x4::flipCoordinates | ( | ) |
Flips between right-handed and left-handed coordinate systems by multiplying the y and z co-ordinates by -1.
This is normally used to create a left-handed orthographic view without scaling the viewport as ortho() does.
Definition at line 1569 of file qmatrix4x4.cpp.
void QMatrix4x4::frustum | ( | qreal | left, |
qreal | right, | ||
qreal | bottom, | ||
qreal | top, | ||
qreal | nearPlane, | ||
qreal | farPlane | ||
) |
Multiplies this matrix by another that applies a perspective frustum projection for a window with lower-left corner (left, bottom), upper-right corner (right, top), and the specified nearPlane and farPlane clipping planes.
Definition at line 1447 of file qmatrix4x4.cpp.
QMatrix4x4 QMatrix4x4::inverted | ( | bool * | invertible = 0 | ) | const |
Returns the inverse of this matrix.
Returns the identity if this matrix cannot be inverted; i.e. determinant() is zero. If invertible is not null, then true will be written to that location if the matrix can be inverted; false otherwise.
If the matrix is recognized as the identity or an orthonormal matrix, then this function will quickly invert the matrix using optimized routines.
Definition at line 408 of file qmatrix4x4.cpp.
|
inline |
Returns true if this matrix is the identity; false otherwise.
Definition at line 307 of file qmatrix4x4.h.
Multiplies this matrix by another that applies an eye position transformation.
The center value indicates the center of the view that the eye is looking at. The up value indicates which direction should be considered up with respect to the eye.
Definition at line 1530 of file qmatrix4x4.cpp.
Maps point by multiplying this matrix by point.
Definition at line 923 of file qmatrix4x4.h.
Referenced by mapRect().
Maps point by multiplying this matrix by point.
Definition at line 928 of file qmatrix4x4.h.
Maps point by multiplying this matrix by point.
Definition at line 935 of file qmatrix4x4.h.
Maps point by multiplying this matrix by point.
Definition at line 965 of file qmatrix4x4.h.
Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the results.
The returned rectangle will be an ordinary 2D rectangle with sides parallel to the horizontal and vertical axes.
Definition at line 1758 of file qmatrix4x4.cpp.
Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the results.
The returned rectangle will be an ordinary 2D rectangle with sides parallel to the horizontal and vertical axes.
Definition at line 1802 of file qmatrix4x4.cpp.
Maps vector by multiplying the top 3x3 portion of this matrix by vector.
The translation and projection components of this matrix are ignored.
Definition at line 940 of file qmatrix4x4.h.
QMatrix3x3 QMatrix4x4::normalMatrix | ( | ) | const |
Returns the normal matrix corresponding to this 4x4 transformation.
The normal matrix is the transpose of the inverse of the top-left 3x3 part of this 4x4 matrix. If the 3x3 sub-matrix is not invertible, this function returns the identity.
Definition at line 470 of file qmatrix4x4.cpp.
QMatrix4x4::operator QVariant | ( | ) | const |
Returns the matrix as a QVariant.
Definition at line 1948 of file qmatrix4x4.cpp.
|
inline |
Returns true if this matrix is not identical to other; false otherwise.
This operator uses an exact floating-point comparison.
Definition at line 465 of file qmatrix4x4.h.
|
inline |
Returns a constant reference to the element at position (row, column) in this matrix.
Definition at line 260 of file qmatrix4x4.h.
|
inline |
Returns a reference to the element at position (row, column) in this matrix so that the element can be assigned to.
Definition at line 266 of file qmatrix4x4.h.
|
inline |
Multiplies the contents of other by this matrix.
Definition at line 410 of file qmatrix4x4.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies all elements of this matrix by factor.
Definition at line 423 of file qmatrix4x4.h.
|
inline |
Adds the contents of other to this matrix.
Definition at line 366 of file qmatrix4x4.h.
|
inline |
Subtracts the contents of other from this matrix.
Definition at line 388 of file qmatrix4x4.h.
QMatrix4x4 & QMatrix4x4::operator/= | ( | qreal | divisor | ) |
Divides all elements of this matrix by divisor.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 560 of file qmatrix4x4.cpp.
|
inline |
Returns true if this matrix is identical to other; false otherwise.
This operator uses an exact floating-point comparison.
Definition at line 445 of file qmatrix4x4.h.
void QMatrix4x4::optimize | ( | ) |
Optimize the usage of this matrix from its current elements.
Some operations such as translate(), scale(), and rotate() can be performed more efficiently if the matrix being modified is already known to be the identity, a previous translate(), a previous scale(), etc.
Normally the QMatrix4x4 class keeps track of this special type internally as operations are performed. However, if the matrix is modified directly with operator()() or data(), then QMatrix4x4 will lose track of the special type and will revert to the safest but least efficient operations thereafter.
By calling optimize() after directly modifying the matrix, the programmer can force QMatrix4x4 to recover the special type if the elements appear to conform to one of the known optimized types.
Definition at line 1907 of file qmatrix4x4.cpp.
Referenced by operator>>().
void QMatrix4x4::ortho | ( | const QRect & | rect | ) |
Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by rect.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The near and far clipping planes will be -1 and 1 respectively.
Definition at line 1356 of file qmatrix4x4.cpp.
Referenced by ortho().
void QMatrix4x4::ortho | ( | const QRectF & | rect | ) |
Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by rect.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The near and far clipping planes will be -1 and 1 respectively.
Definition at line 1377 of file qmatrix4x4.cpp.
void QMatrix4x4::ortho | ( | qreal | left, |
qreal | right, | ||
qreal | bottom, | ||
qreal | top, | ||
qreal | nearPlane, | ||
qreal | farPlane | ||
) |
Multiplies this matrix by another that applies an orthographic projection for a window with lower-left corner (left, bottom), upper-right corner (right, top), and the specified nearPlane and farPlane clipping planes.
Definition at line 1390 of file qmatrix4x4.cpp.
|
private |
Definition at line 1859 of file qmatrix4x4.cpp.
Referenced by inverted().
Multiplies this matrix by another that applies a perspective projection.
The field of view will be angle degrees within a window with a given aspect ratio. The projection will have the specified nearPlane and farPlane clipping planes.
Definition at line 1487 of file qmatrix4x4.cpp.
Definition at line 1195 of file qmatrix4x4.cpp.
Referenced by QGraphicsRotation::applyTo().
Multiples this matrix by another that rotates coordinates through angle degrees about vector.
Definition at line 1072 of file qmatrix4x4.cpp.
Multiplies this matrix by another that rotates coordinates through angle degrees about the vector (x, y, z).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1090 of file qmatrix4x4.cpp.
void QMatrix4x4::rotate | ( | const QQuaternion & | quaternion | ) |
Multiples this matrix by another that rotates coordinates according to a specified quaternion.
The quaternion is assumed to have been normalized.
Definition at line 1304 of file qmatrix4x4.cpp.
|
inline |
Returns the elements of row index as a 4D vector.
Definition at line 289 of file qmatrix4x4.h.
Referenced by copyDataTo(), operator<<(), operator>>(), QMatrix4x4(), and transposed().
void QMatrix4x4::scale | ( | const QVector3D & | vector | ) |
Multiplies this matrix by another that scales coordinates by the components of vector.
Definition at line 775 of file qmatrix4x4.cpp.
Referenced by QGraphicsScale::applyTo(), ortho(), and ShaderEffectItem::renderEffect().
Multiplies this matrix by another that scales coordinates by the components x, and y.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 823 of file qmatrix4x4.cpp.
Multiplies this matrix by another that scales coordinates by the components x, y, and z.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 860 of file qmatrix4x4.cpp.
void QMatrix4x4::scale | ( | qreal | factor | ) |
Multiplies this matrix by another that scales coordinates by the given factor.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 904 of file qmatrix4x4.cpp.
|
inline |
Sets the elements of column index to the components of value.
Definition at line 279 of file qmatrix4x4.h.
|
inline |
Sets the elements of row index to the components of value.
Definition at line 295 of file qmatrix4x4.h.
|
inline |
Sets this matrix to the identity.
Definition at line 324 of file qmatrix4x4.h.
Referenced by projectedRotate(), and rotate().
QMatrix QMatrix4x4::toAffine | ( | ) | const |
Returns the conventional Qt 2D affine transformation matrix that corresponds to this matrix.
It is assumed that this matrix only contains 2D affine transformation elements.
Definition at line 1613 of file qmatrix4x4.cpp.
QGenericMatrix< N, M, qreal > QMatrix4x4::toGenericMatrix | ( | ) | const |
Constructs a NxM generic matrix from the left-most N columns and top-most M rows of this 4x4 matrix.
If N or M is greater than 4, then the remaining elements are filled with elements from the identity matrix.
Definition at line 243 of file qmatrix4x4.h.
QTransform QMatrix4x4::toTransform | ( | ) | const |
Returns the conventional Qt 2D transformation matrix that corresponds to this matrix.
The returned QTransform is formed by simply dropping the third row and third column of the QMatrix4x4. This is suitable for implementing orthographic projections where the z co-ordinate should be dropped rather than projected.
Definition at line 1631 of file qmatrix4x4.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QGraphicsItemPrivate::TransformData::computedFullTransform(), and QGraphicsItemGroup::removeFromGroup().
QTransform QMatrix4x4::toTransform | ( | qreal | distanceToPlane | ) | const |
Returns the conventional Qt 2D transformation matrix that corresponds to this matrix.
If distanceToPlane is non-zero, it indicates a projection factor to use to adjust for the z co-ordinate. The value of 1024 corresponds to the projection factor used by QTransform::rotate() for the x and y axes.
If distanceToPlane is zero, then the returned QTransform is formed by simply dropping the third row and third column of the QMatrix4x4. This is suitable for implementing orthographic projections where the z co-ordinate should be dropped rather than projected.
Definition at line 1655 of file qmatrix4x4.cpp.
void QMatrix4x4::translate | ( | const QVector3D & | vector | ) |
Multiplies this matrix by another that translates coordinates by the components of vector.
Definition at line 944 of file qmatrix4x4.cpp.
Referenced by QDeclarativeTranslate::applyTo(), QGraphicsScale::applyTo(), QGraphicsRotation::applyTo(), lookAt(), ortho(), and ShaderEffectItem::renderEffect().
Multiplies this matrix by another that translates coordinates by the components x, and y.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 992 of file qmatrix4x4.cpp.
Multiplies this matrix by another that translates coordinates by the components x, y, and z.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1032 of file qmatrix4x4.cpp.
QMatrix4x4 QMatrix4x4::transposed | ( | ) | const |
Returns this matrix, transposed about its diagonal.
Definition at line 510 of file qmatrix4x4.cpp.
|
friend |
Returns the product of m1 and m2.
Definition at line 529 of file qmatrix4x4.h.
|
friend |
Returns the result of transforming vector according to matrix, with the matrix applied pre-vector.
Definition at line 631 of file qmatrix4x4.h.
|
friend |
Returns the result of transforming vector according to matrix, with the matrix applied post-vector.
Definition at line 606 of file qmatrix4x4.h.
|
friend |
Returns the result of transforming vector according to matrix, with the matrix applied post-vector.
Definition at line 677 of file qmatrix4x4.h.
|
friend |
Returns the result of transforming vector according to matrix, with the matrix applied pre-vector.
Definition at line 699 of file qmatrix4x4.h.
|
friend |
Returns the result of transforming point according to matrix, with the matrix applied post-point.
Definition at line 723 of file qmatrix4x4.h.
|
friend |
Returns the result of transforming point according to matrix, with the matrix applied post-point.
Definition at line 744 of file qmatrix4x4.h.
|
friend |
Returns the result of transforming point according to matrix, with the matrix applied pre-point.
Definition at line 766 of file qmatrix4x4.h.
|
friend |
Returns the result of transforming point according to matrix, with the matrix applied pre-point.
Definition at line 801 of file qmatrix4x4.h.
|
friend |
Returns the result of multiplying all elements of matrix by factor.
Definition at line 859 of file qmatrix4x4.h.
|
friend |
Returns the result of multiplying all elements of matrix by factor.
Definition at line 881 of file qmatrix4x4.h.
|
friend |
Returns the sum of m1 and m2.
Definition at line 485 of file qmatrix4x4.h.
|
friend |
Returns the difference of m1 and m2.
Definition at line 507 of file qmatrix4x4.h.
|
friend |
Returns the negation of matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 837 of file qmatrix4x4.h.
|
friend |
Returns the result of dividing all elements of matrix by divisor.
Definition at line 734 of file qmatrix4x4.cpp.
|
friend |
Definition at line 1955 of file qmatrix4x4.cpp.
|
related |
Writes the given matrix to the given stream and returns a reference to the stream.
Definition at line 2000 of file qmatrix4x4.cpp.
|
related |
Reads a 4x4 matrix from the given stream into the given matrix and returns a reference to the stream.
Definition at line 2021 of file qmatrix4x4.cpp.
|
friend |
Returns true if m1 and m2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.
Definition at line 903 of file qmatrix4x4.h.
|
related |
Returns a NxM generic matrix constructed from the left-most N columns and top-most M rows of matrix.
If N or M is greater than 4, then the remaining elements are filled with elements from the identity matrix.
Definition at line 997 of file qmatrix4x4.h.
|
related |
Returns a 4x4 matrix constructed from the left-most 4 columns and top-most 4 rows of matrix.
If matrix has less than 4 columns or rows, the remaining elements are filled with elements from the identity matrix.
Definition at line 991 of file qmatrix4x4.h.
|
friend |
Definition at line 206 of file qmatrix4x4.h.
|
private |
Definition at line 189 of file qmatrix4x4.h.
Referenced by flipCoordinates(), inverted(), mapRect(), normalMatrix(), operator*(), operator*=(), operator/=(), operator<<(), optimize(), projectedRotate(), QMatrix4x4(), rotate(), scale(), and translate().
|
private |
Definition at line 188 of file qmatrix4x4.h.
Referenced by frustum(), inverted(), lookAt(), operator!=(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator<<(), operator==(), ortho(), orthonormalInverse(), perspective(), projectedRotate(), qFuzzyCompare(), QMatrix4x4(), rotate(), and transposed().