45 #include <QtGui/qvector3d.h> 46 #include <QtGui/qvector4d.h> 47 #include <QtGui/qquaternion.h> 48 #include <QtGui/qgenericmatrix.h> 49 #include <QtCore/qrect.h> 57 #ifndef QT_NO_MATRIX4X4 73 template <
int N,
int M>
76 QMatrix4x4(
const qreal *values,
int cols,
int rows);
78 QMatrix4x4(
const QMatrix& matrix);
80 inline const qreal& operator()(
int row,
int column)
const;
81 inline qreal& operator()(
int row,
int column);
84 inline void setColumn(
int index,
const QVector4D& value);
87 inline void setRow(
int index,
const QVector4D& value);
89 inline bool isIdentity()
const;
90 inline void setToIdentity();
92 inline void fill(
qreal value);
94 qreal determinant()
const;
95 QMatrix4x4 inverted(
bool *invertible = 0)
const;
96 QMatrix4x4 transposed()
const;
99 inline QMatrix4x4&
operator+=(
const QMatrix4x4& other);
100 inline QMatrix4x4& operator-=(
const QMatrix4x4& other);
101 inline QMatrix4x4& operator*=(
const QMatrix4x4& other);
102 inline QMatrix4x4& operator*=(
qreal factor);
103 QMatrix4x4& operator/=(
qreal divisor);
104 inline bool operator==(
const QMatrix4x4& other)
const;
105 inline bool operator!=(
const QMatrix4x4& other)
const;
107 friend QMatrix4x4
operator+(
const QMatrix4x4& m1,
const QMatrix4x4& m2);
108 friend QMatrix4x4
operator-(
const QMatrix4x4& m1,
const QMatrix4x4& m2);
109 friend QMatrix4x4
operator*(
const QMatrix4x4& m1,
const QMatrix4x4& m2);
110 #ifndef QT_NO_VECTOR3D 114 #ifndef QT_NO_VECTOR4D 120 friend QMatrix4x4
operator-(
const QMatrix4x4& matrix);
123 friend QMatrix4x4
operator*(
qreal factor,
const QMatrix4x4& matrix);
124 friend QMatrix4x4
operator*(
const QMatrix4x4& matrix,
qreal factor);
127 friend inline bool qFuzzyCompare(
const QMatrix4x4& m1,
const QMatrix4x4& m2);
129 #ifndef QT_NO_VECTOR3D 136 void scale(
qreal factor);
140 #ifndef QT_NO_QUATERNION 144 void ortho(
const QRect& rect);
145 void ortho(
const QRectF& rect);
149 #ifndef QT_NO_VECTOR3D 152 void flipCoordinates();
154 void copyDataTo(
qreal *values)
const;
162 #ifndef QT_NO_VECTOR3D 166 #ifndef QT_NO_VECTOR4D 172 template <
int N,
int M>
183 #ifndef QT_NO_DEBUG_STREAM 194 Translation = 0x0004,
202 QMatrix4x4 orthonormalInverse()
const;
217 m[0][0] = m11; m[0][1] = m21; m[0][2] = m31; m[0][3] = m41;
218 m[1][0] = m12; m[1][1] = m22; m[1][2] = m32; m[1][3] = m42;
219 m[2][0] = m13; m[2][1] = m23; m[2][2] = m33; m[2][3] = m43;
220 m[3][0] = m14; m[3][1] = m24; m[3][2] = m34; m[3][3] = m44;
224 template <
int N,
int M>
229 for (
int matrixCol = 0; matrixCol < 4; ++matrixCol) {
230 for (
int matrixRow = 0; matrixRow < 4; ++matrixRow) {
231 if (matrixCol < N && matrixRow <
M)
232 m[matrixCol][matrixRow] = values[matrixCol *
M + matrixRow];
233 else if (matrixCol == matrixRow)
234 m[matrixCol][matrixRow] = 1.0f;
236 m[matrixCol][matrixRow] = 0.0f;
242 template <
int N,
int M>
247 for (
int matrixCol = 0; matrixCol < N; ++matrixCol) {
248 for (
int matrixRow = 0; matrixRow <
M; ++matrixRow) {
249 if (matrixCol < 4 && matrixRow < 4)
250 values[matrixCol * M + matrixRow] = m[matrixCol][matrixRow];
251 else if (matrixCol == matrixRow)
252 values[matrixCol * M + matrixRow] = 1.0f;
254 values[matrixCol * M + matrixRow] = 0.0f;
262 Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
263 return m[aColumn][aRow];
268 Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
270 return m[aColumn][aRow];
276 return QVector4D(m[index][0], m[index][1], m[index][2], m[index][3]);
292 return QVector4D(m[0][index], m[1][index], m[2][index], m[3][index]);
309 if (flagBits == Identity)
311 if (m[0][0] != 1.0f || m[0][1] != 0.0f || m[0][2] != 0.0f)
313 if (m[0][3] != 0.0f || m[1][0] != 0.0f || m[1][1] != 1.0f)
315 if (m[1][2] != 0.0f || m[1][3] != 0.0f || m[2][0] != 0.0f)
317 if (m[2][1] != 0.0f || m[2][2] != 1.0f || m[2][3] != 0.0f)
319 if (m[3][0] != 0.0f || m[3][1] != 0.0f || m[3][2] != 0.0f)
321 return (m[3][3] == 1.0f);
368 m[0][0] += other.
m[0][0];
369 m[0][1] += other.
m[0][1];
370 m[0][2] += other.
m[0][2];
371 m[0][3] += other.
m[0][3];
372 m[1][0] += other.
m[1][0];
373 m[1][1] += other.
m[1][1];
374 m[1][2] += other.
m[1][2];
375 m[1][3] += other.
m[1][3];
376 m[2][0] += other.
m[2][0];
377 m[2][1] += other.
m[2][1];
378 m[2][2] += other.
m[2][2];
379 m[2][3] += other.
m[2][3];
380 m[3][0] += other.
m[3][0];
381 m[3][1] += other.
m[3][1];
382 m[3][2] += other.
m[3][2];
383 m[3][3] += other.
m[3][3];
390 m[0][0] -= other.
m[0][0];
391 m[0][1] -= other.
m[0][1];
392 m[0][2] -= other.
m[0][2];
393 m[0][3] -= other.
m[0][3];
394 m[1][0] -= other.
m[1][0];
395 m[1][1] -= other.
m[1][1];
396 m[1][2] -= other.
m[1][2];
397 m[1][3] -= other.
m[1][3];
398 m[2][0] -= other.
m[2][0];
399 m[2][1] -= other.
m[2][1];
400 m[2][2] -= other.
m[2][2];
401 m[2][3] -= other.
m[2][3];
402 m[3][0] -= other.
m[3][0];
403 m[3][1] -= other.
m[3][1];
404 m[3][2] -= other.
m[3][2];
405 m[3][3] -= other.
m[3][3];
412 if (flagBits == Identity) {
415 }
else if (other.
flagBits == Identity) {
418 *
this = *
this * other;
447 return m[0][0] == other.
m[0][0] &&
448 m[0][1] == other.
m[0][1] &&
449 m[0][2] == other.
m[0][2] &&
450 m[0][3] == other.
m[0][3] &&
451 m[1][0] == other.
m[1][0] &&
452 m[1][1] == other.
m[1][1] &&
453 m[1][2] == other.
m[1][2] &&
454 m[1][3] == other.
m[1][3] &&
455 m[2][0] == other.
m[2][0] &&
456 m[2][1] == other.
m[2][1] &&
457 m[2][2] == other.
m[2][2] &&
458 m[2][3] == other.
m[2][3] &&
459 m[3][0] == other.
m[3][0] &&
460 m[3][1] == other.
m[3][1] &&
461 m[3][2] == other.
m[3][2] &&
462 m[3][3] == other.
m[3][3];
467 return m[0][0] != other.
m[0][0] ||
468 m[0][1] != other.
m[0][1] ||
469 m[0][2] != other.
m[0][2] ||
470 m[0][3] != other.
m[0][3] ||
471 m[1][0] != other.
m[1][0] ||
472 m[1][1] != other.
m[1][1] ||
473 m[1][2] != other.
m[1][2] ||
474 m[1][3] != other.
m[1][3] ||
475 m[2][0] != other.
m[2][0] ||
476 m[2][1] != other.
m[2][1] ||
477 m[2][2] != other.
m[2][2] ||
478 m[2][3] != other.
m[2][3] ||
479 m[3][0] != other.
m[3][0] ||
480 m[3][1] != other.
m[3][1] ||
481 m[3][2] != other.
m[3][2] ||
482 m[3][3] != other.
m[3][3];
488 m.
m[0][0] = m1.
m[0][0] + m2.
m[0][0];
489 m.
m[0][1] = m1.
m[0][1] + m2.
m[0][1];
490 m.
m[0][2] = m1.
m[0][2] + m2.
m[0][2];
491 m.
m[0][3] = m1.
m[0][3] + m2.
m[0][3];
492 m.
m[1][0] = m1.
m[1][0] + m2.
m[1][0];
493 m.
m[1][1] = m1.
m[1][1] + m2.
m[1][1];
494 m.
m[1][2] = m1.
m[1][2] + m2.
m[1][2];
495 m.
m[1][3] = m1.
m[1][3] + m2.
m[1][3];
496 m.
m[2][0] = m1.
m[2][0] + m2.
m[2][0];
497 m.
m[2][1] = m1.
m[2][1] + m2.
m[2][1];
498 m.
m[2][2] = m1.
m[2][2] + m2.
m[2][2];
499 m.
m[2][3] = m1.
m[2][3] + m2.
m[2][3];
500 m.
m[3][0] = m1.
m[3][0] + m2.
m[3][0];
501 m.
m[3][1] = m1.
m[3][1] + m2.
m[3][1];
502 m.
m[3][2] = m1.
m[3][2] + m2.
m[3][2];
503 m.
m[3][3] = m1.
m[3][3] + m2.
m[3][3];
510 m.
m[0][0] = m1.
m[0][0] - m2.
m[0][0];
511 m.
m[0][1] = m1.
m[0][1] - m2.
m[0][1];
512 m.
m[0][2] = m1.
m[0][2] - m2.
m[0][2];
513 m.
m[0][3] = m1.
m[0][3] - m2.
m[0][3];
514 m.
m[1][0] = m1.
m[1][0] - m2.
m[1][0];
515 m.
m[1][1] = m1.
m[1][1] - m2.
m[1][1];
516 m.
m[1][2] = m1.
m[1][2] - m2.
m[1][2];
517 m.
m[1][3] = m1.
m[1][3] - m2.
m[1][3];
518 m.
m[2][0] = m1.
m[2][0] - m2.
m[2][0];
519 m.
m[2][1] = m1.
m[2][1] - m2.
m[2][1];
520 m.
m[2][2] = m1.
m[2][2] - m2.
m[2][2];
521 m.
m[2][3] = m1.
m[2][3] - m2.
m[2][3];
522 m.
m[3][0] = m1.
m[3][0] - m2.
m[3][0];
523 m.
m[3][1] = m1.
m[3][1] - m2.
m[3][1];
524 m.
m[3][2] = m1.
m[3][2] - m2.
m[3][2];
525 m.
m[3][3] = m1.
m[3][3] - m2.
m[3][3];
537 m.
m[0][0] = m1.
m[0][0] * m2.
m[0][0] +
538 m1.
m[1][0] * m2.
m[0][1] +
539 m1.
m[2][0] * m2.
m[0][2] +
540 m1.
m[3][0] * m2.
m[0][3];
541 m.
m[0][1] = m1.
m[0][1] * m2.
m[0][0] +
542 m1.
m[1][1] * m2.
m[0][1] +
543 m1.
m[2][1] * m2.
m[0][2] +
544 m1.
m[3][1] * m2.
m[0][3];
545 m.
m[0][2] = m1.
m[0][2] * m2.
m[0][0] +
546 m1.
m[1][2] * m2.
m[0][1] +
547 m1.
m[2][2] * m2.
m[0][2] +
548 m1.
m[3][2] * m2.
m[0][3];
549 m.
m[0][3] = m1.
m[0][3] * m2.
m[0][0] +
550 m1.
m[1][3] * m2.
m[0][1] +
551 m1.
m[2][3] * m2.
m[0][2] +
552 m1.
m[3][3] * m2.
m[0][3];
553 m.
m[1][0] = m1.
m[0][0] * m2.
m[1][0] +
554 m1.
m[1][0] * m2.
m[1][1] +
555 m1.
m[2][0] * m2.
m[1][2] +
556 m1.
m[3][0] * m2.
m[1][3];
557 m.
m[1][1] = m1.
m[0][1] * m2.
m[1][0] +
558 m1.
m[1][1] * m2.
m[1][1] +
559 m1.
m[2][1] * m2.
m[1][2] +
560 m1.
m[3][1] * m2.
m[1][3];
561 m.
m[1][2] = m1.
m[0][2] * m2.
m[1][0] +
562 m1.
m[1][2] * m2.
m[1][1] +
563 m1.
m[2][2] * m2.
m[1][2] +
564 m1.
m[3][2] * m2.
m[1][3];
565 m.
m[1][3] = m1.
m[0][3] * m2.
m[1][0] +
566 m1.
m[1][3] * m2.
m[1][1] +
567 m1.
m[2][3] * m2.
m[1][2] +
568 m1.
m[3][3] * m2.
m[1][3];
569 m.
m[2][0] = m1.
m[0][0] * m2.
m[2][0] +
570 m1.
m[1][0] * m2.
m[2][1] +
571 m1.
m[2][0] * m2.
m[2][2] +
572 m1.
m[3][0] * m2.
m[2][3];
573 m.
m[2][1] = m1.
m[0][1] * m2.
m[2][0] +
574 m1.
m[1][1] * m2.
m[2][1] +
575 m1.
m[2][1] * m2.
m[2][2] +
576 m1.
m[3][1] * m2.
m[2][3];
577 m.
m[2][2] = m1.
m[0][2] * m2.
m[2][0] +
578 m1.
m[1][2] * m2.
m[2][1] +
579 m1.
m[2][2] * m2.
m[2][2] +
580 m1.
m[3][2] * m2.
m[2][3];
581 m.
m[2][3] = m1.
m[0][3] * m2.
m[2][0] +
582 m1.
m[1][3] * m2.
m[2][1] +
583 m1.
m[2][3] * m2.
m[2][2] +
584 m1.
m[3][3] * m2.
m[2][3];
585 m.
m[3][0] = m1.
m[0][0] * m2.
m[3][0] +
586 m1.
m[1][0] * m2.
m[3][1] +
587 m1.
m[2][0] * m2.
m[3][2] +
588 m1.
m[3][0] * m2.
m[3][3];
589 m.
m[3][1] = m1.
m[0][1] * m2.
m[3][0] +
590 m1.
m[1][1] * m2.
m[3][1] +
591 m1.
m[2][1] * m2.
m[3][2] +
592 m1.
m[3][1] * m2.
m[3][3];
593 m.
m[3][2] = m1.
m[0][2] * m2.
m[3][0] +
594 m1.
m[1][2] * m2.
m[3][1] +
595 m1.
m[2][2] * m2.
m[3][2] +
596 m1.
m[3][2] * m2.
m[3][3];
597 m.
m[3][3] = m1.
m[0][3] * m2.
m[3][0] +
598 m1.
m[1][3] * m2.
m[3][1] +
599 m1.
m[2][3] * m2.
m[3][2] +
600 m1.
m[3][3] * m2.
m[3][3];
604 #ifndef QT_NO_VECTOR3D 609 x = vector.
x() * matrix.
m[0][0] +
610 vector.
y() * matrix.
m[0][1] +
611 vector.
z() * matrix.
m[0][2] +
613 y = vector.
x() * matrix.
m[1][0] +
614 vector.
y() * matrix.
m[1][1] +
615 vector.
z() * matrix.
m[1][2] +
617 z = vector.
x() * matrix.
m[2][0] +
618 vector.
y() * matrix.
m[2][1] +
619 vector.
z() * matrix.
m[2][2] +
621 w = vector.
x() * matrix.
m[3][0] +
622 vector.
y() * matrix.
m[3][1] +
623 vector.
z() * matrix.
m[3][2] +
638 vector.
y() + matrix.
m[3][1],
639 vector.
z() + matrix.
m[3][2]);
642 return QVector3D(vector.
x() * matrix.
m[0][0] + matrix.
m[3][0],
643 vector.
y() * matrix.
m[1][1] + matrix.
m[3][1],
644 vector.
z() * matrix.
m[2][2] + matrix.
m[3][2]);
647 vector.
y() * matrix.
m[1][1],
648 vector.
z() * matrix.
m[2][2]);
650 x = vector.
x() * matrix.
m[0][0] +
651 vector.
y() * matrix.
m[1][0] +
652 vector.
z() * matrix.
m[2][0] +
654 y = vector.
x() * matrix.
m[0][1] +
655 vector.
y() * matrix.
m[1][1] +
656 vector.
z() * matrix.
m[2][1] +
658 z = vector.
x() * matrix.
m[0][2] +
659 vector.
y() * matrix.
m[1][2] +
660 vector.
z() * matrix.
m[2][2] +
662 w = vector.
x() * matrix.
m[0][3] +
663 vector.
y() * matrix.
m[1][3] +
664 vector.
z() * matrix.
m[2][3] +
675 #ifndef QT_NO_VECTOR4D 680 x = vector.
x() * matrix.
m[0][0] +
681 vector.
y() * matrix.
m[0][1] +
682 vector.
z() * matrix.
m[0][2] +
683 vector.
w() * matrix.
m[0][3];
684 y = vector.
x() * matrix.
m[1][0] +
685 vector.
y() * matrix.
m[1][1] +
686 vector.
z() * matrix.
m[1][2] +
687 vector.
w() * matrix.
m[1][3];
688 z = vector.
x() * matrix.
m[2][0] +
689 vector.
y() * matrix.
m[2][1] +
690 vector.
z() * matrix.
m[2][2] +
691 vector.
w() * matrix.
m[2][3];
692 w = vector.
x() * matrix.
m[3][0] +
693 vector.
y() * matrix.
m[3][1] +
694 vector.
z() * matrix.
m[3][2] +
695 vector.
w() * matrix.
m[3][3];
702 x = vector.
x() * matrix.
m[0][0] +
703 vector.
y() * matrix.
m[1][0] +
704 vector.
z() * matrix.
m[2][0] +
705 vector.
w() * matrix.
m[3][0];
706 y = vector.
x() * matrix.
m[0][1] +
707 vector.
y() * matrix.
m[1][1] +
708 vector.
z() * matrix.
m[2][1] +
709 vector.
w() * matrix.
m[3][1];
710 z = vector.
x() * matrix.
m[0][2] +
711 vector.
y() * matrix.
m[1][2] +
712 vector.
z() * matrix.
m[2][2] +
713 vector.
w() * matrix.
m[3][2];
714 w = vector.
x() * matrix.
m[0][3] +
715 vector.
y() * matrix.
m[1][3] +
716 vector.
z() * matrix.
m[2][3] +
717 vector.
w() * matrix.
m[3][3];
729 x = xin * matrix.
m[0][0] +
730 yin * matrix.
m[0][1] +
732 y = xin * matrix.
m[1][0] +
733 yin * matrix.
m[1][1] +
735 w = xin * matrix.
m[3][0] +
736 yin * matrix.
m[3][1] +
750 x = xin * matrix.
m[0][0] +
751 yin * matrix.
m[0][1] +
753 y = xin * matrix.
m[1][0] +
754 yin * matrix.
m[1][1] +
756 w = xin * matrix.
m[3][0] +
757 yin * matrix.
m[3][1] +
780 qRound(yin * matrix.
m[1][1] + matrix.
m[3][1]));
785 x = xin * matrix.
m[0][0] +
786 yin * matrix.
m[1][0] +
788 y = xin * matrix.
m[0][1] +
789 yin * matrix.
m[1][1] +
791 w = xin * matrix.
m[0][3] +
792 yin * matrix.
m[1][3] +
810 return QPointF(xin + matrix.
m[3][0],
811 yin + matrix.
m[3][1]);
814 return QPointF(xin * matrix.
m[0][0] + matrix.
m[3][0],
815 yin * matrix.
m[1][1] + matrix.
m[3][1]);
817 return QPointF(xin * matrix.
m[0][0],
818 yin * matrix.
m[1][1]);
820 x = xin * matrix.
m[0][0] +
821 yin * matrix.
m[1][0] +
823 y = xin * matrix.
m[0][1] +
824 yin * matrix.
m[1][1] +
826 w = xin * matrix.
m[0][3] +
827 yin * matrix.
m[1][3] +
840 m.
m[0][0] = -matrix.
m[0][0];
841 m.
m[0][1] = -matrix.
m[0][1];
842 m.
m[0][2] = -matrix.
m[0][2];
843 m.
m[0][3] = -matrix.
m[0][3];
844 m.
m[1][0] = -matrix.
m[1][0];
845 m.
m[1][1] = -matrix.
m[1][1];
846 m.
m[1][2] = -matrix.
m[1][2];
847 m.
m[1][3] = -matrix.
m[1][3];
848 m.
m[2][0] = -matrix.
m[2][0];
849 m.
m[2][1] = -matrix.
m[2][1];
850 m.
m[2][2] = -matrix.
m[2][2];
851 m.
m[2][3] = -matrix.
m[2][3];
852 m.
m[3][0] = -matrix.
m[3][0];
853 m.
m[3][1] = -matrix.
m[3][1];
854 m.
m[3][2] = -matrix.
m[3][2];
855 m.
m[3][3] = -matrix.
m[3][3];
862 m.
m[0][0] = matrix.
m[0][0] * factor;
863 m.
m[0][1] = matrix.
m[0][1] * factor;
864 m.
m[0][2] = matrix.
m[0][2] * factor;
865 m.
m[0][3] = matrix.
m[0][3] * factor;
866 m.
m[1][0] = matrix.
m[1][0] * factor;
867 m.
m[1][1] = matrix.
m[1][1] * factor;
868 m.
m[1][2] = matrix.
m[1][2] * factor;
869 m.
m[1][3] = matrix.
m[1][3] * factor;
870 m.
m[2][0] = matrix.
m[2][0] * factor;
871 m.
m[2][1] = matrix.
m[2][1] * factor;
872 m.
m[2][2] = matrix.
m[2][2] * factor;
873 m.
m[2][3] = matrix.
m[2][3] * factor;
874 m.
m[3][0] = matrix.
m[3][0] * factor;
875 m.
m[3][1] = matrix.
m[3][1] * factor;
876 m.
m[3][2] = matrix.
m[3][2] * factor;
877 m.
m[3][3] = matrix.
m[3][3] * factor;
884 m.
m[0][0] = matrix.
m[0][0] * factor;
885 m.
m[0][1] = matrix.
m[0][1] * factor;
886 m.
m[0][2] = matrix.
m[0][2] * factor;
887 m.
m[0][3] = matrix.
m[0][3] * factor;
888 m.
m[1][0] = matrix.
m[1][0] * factor;
889 m.
m[1][1] = matrix.
m[1][1] * factor;
890 m.
m[1][2] = matrix.
m[1][2] * factor;
891 m.
m[1][3] = matrix.
m[1][3] * factor;
892 m.
m[2][0] = matrix.
m[2][0] * factor;
893 m.
m[2][1] = matrix.
m[2][1] * factor;
894 m.
m[2][2] = matrix.
m[2][2] * factor;
895 m.
m[2][3] = matrix.
m[2][3] * factor;
896 m.
m[3][0] = matrix.
m[3][0] * factor;
897 m.
m[3][1] = matrix.
m[3][1] * factor;
898 m.
m[3][2] = matrix.
m[3][2] * factor;
899 m.
m[3][3] = matrix.
m[3][3] * factor;
925 return *
this * point;
930 return *
this * point;
933 #ifndef QT_NO_VECTOR3D 937 return *
this * point;
942 if (flagBits == Identity || flagBits == Translation) {
944 }
else if (flagBits ==
Scale || flagBits == (Translation |
Scale)) {
946 vector.
y() * m[1][1],
947 vector.
z() * m[2][2]);
950 vector.
y() * m[1][0] +
951 vector.
z() * m[2][0],
952 vector.
x() * m[0][1] +
953 vector.
y() * m[1][1] +
954 vector.
z() * m[2][1],
955 vector.
x() * m[0][2] +
956 vector.
y() * m[1][2] +
957 vector.
z() * m[2][2]);
963 #ifndef QT_NO_VECTOR4D 967 return *
this * point;
980 #ifndef QT_NO_DEBUG_STREAM 984 #ifndef QT_NO_DATASTREAM 990 template <
int N,
int M>
996 template <
int N,
int M>
1002 for (
int col = 0; col < N; ++col) {
1003 for (
int row = 0; row <
M; ++row) {
1004 if (col < 4 && row < 4)
1005 values[col * M + row] = m[col * 4 + row];
1006 else if (col == row)
1007 values[col * M + row] = 1.0f;
1009 values[col * M + row] = 0.0f;
The QVariant class acts like a union for the most common Qt data types.
const T * constData() const
Returns a constant pointer to the raw data of this matrix.
The QDebug class provides an output stream for debugging information.
T * data()
Returns a pointer to the raw data of this matrix.
The QVector3D class represents a vector or vertex in 3D space.
QT_DEPRECATED QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix< N, M, qreal > &matrix)
#define QT_END_NAMESPACE
This macro expands to.
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
QMatrix4x4()
Constructs an identity matrix.
The QMatrix class specifies 2D transformations of a coordinate system.
bool qFuzzyCompare(const QMatrix4x4 &m1, const QMatrix4x4 &m2)
The Rotation object provides a way to rotate an Item.
qreal w() const
Returns the w coordinate of this point.
The QVector4D class represents a vector or vertex in 4D space.
The QPointF class defines a point in the plane using floating point precision.
void setRow(int index, const QVector4D &value)
Sets the elements of row index to the components of value.
qreal * data()
Returns a pointer to the raw data of this matrix.
const qreal & operator()(int row, int column) const
Returns a constant reference to the element at position (row, column) in this matrix.
bool operator!=(QBool b1, bool b2)
QT_DEPRECATED QGenericMatrix< N, M, qreal > qGenericMatrixFromMatrix4x4(const QMatrix4x4 &matrix)
qreal x() const
Returns the x coordinate of this point.
QPoint map(const QPoint &point) const
Maps point by multiplying this matrix by point.
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...
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
qreal x() const
Returns the x-coordinate of this point.
Q_DECLARE_TYPEINFO(QMatrix4x4, Q_MOVABLE_TYPE)
void setColumn(int index, const QVector4D &value)
Sets the elements of column index to the components of value.
QVector4D column(int index) const
Returns the elements of column index as a 4D vector.
QMatrix4x4 & operator+=(const QMatrix4x4 &other)
Adds the contents of other to this matrix.
QFuture< void > map(Sequence &sequence, MapFunction function)
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QMatrix4x4 & operator-=(const QMatrix4x4 &other)
Subtracts the contents of other from this matrix.
bool operator==(const QMatrix4x4 &other) const
Returns true if this matrix is identical to other; false otherwise.
qreal x() const
Returns the x coordinate of this point.
Q_GUI_EXPORT QMatrix4x4 operator/(const QMatrix4x4 &matrix, qreal divisor)
void setToIdentity()
Sets this matrix to the identity.
QMatrix4x4 operator+(const QMatrix4x4 &m1, const QMatrix4x4 &m2)
QVector4D row(int index) const
Returns the elements of row index as a 4D vector.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
#define Q_INLINE_TEMPLATE
static const char * data(const QByteArray &arr)
void fill(qreal value)
Fills all elements of this matrx with value.
const qreal * constData() const
Returns a constant pointer to the raw data of this matrix.
qreal z() const
Returns the z coordinate of this point.
const qreal * data() const
Returns a constant pointer to the raw data of this matrix.
QVector3D mapVector(const QVector3D &vector) const
Maps vector by multiplying the top 3x3 portion of this matrix by vector.
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
bool operator!=(const QMatrix4x4 &other) const
Returns true if this matrix is not identical to other; false otherwise.
qreal angle(const QPointF &p1, const QPointF &p2)
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
The Scale element provides a way to scale an Item.
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QMatrix4x4 &)
The QPoint class defines a point in the plane using integer precision.
qreal y() const
Returns the y coordinate of this point.
QMatrix4x4 operator-(const QMatrix4x4 &m1, const QMatrix4x4 &m2)
The QRect class defines a rectangle in the plane using integer precision.
The QQuaternion class represents a quaternion consisting of a vector and scalar.
int y() const
Returns the y coordinate of this point.
qreal y() const
Returns the y-coordinate of this point.
QMatrix4x4 operator*(const QMatrix4x4 &m1, const QMatrix4x4 &m2)
The QGraphicsRotation class provides a rotation transformation around a given axis.
The QDataStream class provides serialization of binary data to a QIODevice.
int x() const
Returns the x coordinate of this point.
timeval & operator+=(timeval &t1, const timeval &t2)
QMatrix4x4 & operator*=(const QMatrix4x4 &other)
Multiplies the contents of other by this matrix.
qreal z() const
Returns the z coordinate of this point.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
bool operator==(QBool b1, bool b2)
qreal y() const
Returns the y coordinate of this point.
Q_DECL_CONSTEXPR int qRound(qreal d)
bool isIdentity() const
Returns true if this matrix is the identity; false otherwise.