4#ifndef QDOUBLEMATRIX4X4_H
5#define QDOUBLEMATRIX4X4_H
18#include <QtPositioning/private/qpositioningglobal_p.h>
19#include <QtPositioning/private/qdoublevector3d_p.h>
20#include <QtCore/QDebug>
21#include <QtCore/qmetatype.h>
22#include <QtCore/QRectF>
39 double m21,
double m22,
double m23,
double m24,
40 double m31,
double m32,
double m33,
double m34,
41 double m41,
double m42,
double m43,
double m44);
45 inline const double& operator()(
int row,
int column)
const;
46 inline double& operator()(
int row,
int column);
48 inline bool isAffine()
const;
50 inline bool isIdentity()
const;
51 inline void setToIdentity();
55 double determinant()
const;
91 void scale(
double x,
double y,
double z);
92 void scale(
double factor);
95 void rotate(
double angle,
double x,
double y,
double z = 0.0f);
99 void ortho(
double left,
double right,
double bottom,
double top,
double nearPlane,
double farPlane);
100 void frustum(
double left,
double right,
double bottom,
double top,
double nearPlane,
double farPlane);
101 void perspective(
double verticalAngle,
double aspectRatio,
double nearPlane,
double farPlane);
107 void flipCoordinates();
109 void copyDataTo(
double *
values)
const;
120 inline double *
data();
121 inline const double *
data()
const {
return *
m; }
126#ifndef QT_NO_DEBUG_STREAM
137 Translation = 0x0001,
141 Perspective = 0x0010,
150 void projectedRotate(
double angle,
double x,
double y,
double z,
151 double distanceToPlane = 1024.0);
157 (
double m11,
double m12,
double m13,
double m14,
158 double m21,
double m22,
double m23,
double m24,
159 double m31,
double m32,
double m33,
double m34,
160 double m41,
double m42,
double m43,
double m44)
162 m[0][0] = m11;
m[0][1] = m21;
m[0][2] = m31;
m[0][3] = m41;
163 m[1][0] = m12;
m[1][1] = m22;
m[1][2] = m32;
m[1][3] = m42;
164 m[2][0] = m13;
m[2][1] = m23;
m[2][2] = m33;
m[2][3] = m43;
165 m[3][0] = m14;
m[3][1] = m24;
m[3][2] = m34;
m[3][3] = m44;
171 Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
172 return m[aColumn][aRow];
177 Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
179 return m[aColumn][aRow];
186 return m[0][3] == 0.0f &&
m[1][3] == 0.0f &&
m[2][3] == 0.0f &&
m[3][3] == 1.0f;
191 if (flagBits == Identity)
193 if (
m[0][0] != 1.0f ||
m[0][1] != 0.0f ||
m[0][2] != 0.0f)
195 if (
m[0][3] != 0.0f ||
m[1][0] != 0.0f ||
m[1][1] != 1.0f)
197 if (
m[1][2] != 0.0f ||
m[1][3] != 0.0f ||
m[2][0] != 0.0f)
199 if (
m[2][1] != 0.0f ||
m[2][2] != 1.0f ||
m[2][3] != 0.0f)
201 if (
m[3][0] != 0.0f ||
m[3][1] != 0.0f ||
m[3][2] != 0.0f)
203 return (
m[3][3] == 1.0f);
294 flagBits |=
other.flagBits;
296 if (flagBits < Rotation2D) {
297 m[3][0] +=
m[0][0] *
other.m[3][0];
298 m[3][1] +=
m[1][1] *
other.m[3][1];
299 m[3][2] +=
m[2][2] *
other.m[3][2];
308 m0 =
m[0][0] *
other.m[0][0]
311 +
m[3][0] *
other.m[0][3];
312 m1 =
m[0][0] *
other.m[1][0]
315 +
m[3][0] *
other.m[1][3];
316 m2 =
m[0][0] *
other.m[2][0]
319 +
m[3][0] *
other.m[2][3];
320 m[3][0] =
m[0][0] *
other.m[3][0]
323 +
m[3][0] *
other.m[3][3];
328 m0 =
m[0][1] *
other.m[0][0]
331 +
m[3][1] *
other.m[0][3];
332 m1 =
m[0][1] *
other.m[1][0]
335 +
m[3][1] *
other.m[1][3];
336 m2 =
m[0][1] *
other.m[2][0]
339 +
m[3][1] *
other.m[2][3];
340 m[3][1] =
m[0][1] *
other.m[3][0]
343 +
m[3][1] *
other.m[3][3];
348 m0 =
m[0][2] *
other.m[0][0]
351 +
m[3][2] *
other.m[0][3];
352 m1 =
m[0][2] *
other.m[1][0]
355 +
m[3][2] *
other.m[1][3];
356 m2 =
m[0][2] *
other.m[2][0]
359 +
m[3][2] *
other.m[2][3];
360 m[3][2] =
m[0][2] *
other.m[3][0]
363 +
m[3][2] *
other.m[3][3];
368 m0 =
m[0][3] *
other.m[0][0]
371 +
m[3][3] *
other.m[0][3];
372 m1 =
m[0][3] *
other.m[1][0]
375 +
m[3][3] *
other.m[1][3];
376 m2 =
m[0][3] *
other.m[2][0]
379 +
m[3][3] *
other.m[2][3];
380 m[3][3] =
m[0][3] *
other.m[3][0]
383 +
m[3][3] *
other.m[3][3];
414 return m[0][0] ==
other.m[0][0] &&
415 m[0][1] ==
other.m[0][1] &&
416 m[0][2] ==
other.m[0][2] &&
417 m[0][3] ==
other.m[0][3] &&
418 m[1][0] ==
other.m[1][0] &&
419 m[1][1] ==
other.m[1][1] &&
420 m[1][2] ==
other.m[1][2] &&
421 m[1][3] ==
other.m[1][3] &&
422 m[2][0] ==
other.m[2][0] &&
423 m[2][1] ==
other.m[2][1] &&
424 m[2][2] ==
other.m[2][2] &&
425 m[2][3] ==
other.m[2][3] &&
426 m[3][0] ==
other.m[3][0] &&
427 m[3][1] ==
other.m[3][1] &&
428 m[3][2] ==
other.m[3][2] &&
434 return m[0][0] !=
other.m[0][0] ||
435 m[0][1] !=
other.m[0][1] ||
436 m[0][2] !=
other.m[0][2] ||
437 m[0][3] !=
other.m[0][3] ||
438 m[1][0] !=
other.m[1][0] ||
439 m[1][1] !=
other.m[1][1] ||
440 m[1][2] !=
other.m[1][2] ||
441 m[1][3] !=
other.m[1][3] ||
442 m[2][0] !=
other.m[2][0] ||
443 m[2][1] !=
other.m[2][1] ||
444 m[2][2] !=
other.m[2][2] ||
445 m[2][3] !=
other.m[2][3] ||
446 m[3][0] !=
other.m[3][0] ||
447 m[3][1] !=
other.m[3][1] ||
448 m[3][2] !=
other.m[3][2] ||
455 m.m[0][0] = m1.m[0][0] + m2.m[0][0];
456 m.m[0][1] = m1.m[0][1] + m2.m[0][1];
457 m.m[0][2] = m1.m[0][2] + m2.m[0][2];
458 m.m[0][3] = m1.m[0][3] + m2.m[0][3];
459 m.m[1][0] = m1.m[1][0] + m2.m[1][0];
460 m.m[1][1] = m1.m[1][1] + m2.m[1][1];
461 m.m[1][2] = m1.m[1][2] + m2.m[1][2];
462 m.m[1][3] = m1.m[1][3] + m2.m[1][3];
463 m.m[2][0] = m1.m[2][0] + m2.m[2][0];
464 m.m[2][1] = m1.m[2][1] + m2.m[2][1];
465 m.m[2][2] = m1.m[2][2] + m2.m[2][2];
466 m.m[2][3] = m1.m[2][3] + m2.m[2][3];
467 m.m[3][0] = m1.m[3][0] + m2.m[3][0];
468 m.m[3][1] = m1.m[3][1] + m2.m[3][1];
469 m.m[3][2] = m1.m[3][2] + m2.m[3][2];
470 m.m[3][3] = m1.m[3][3] + m2.m[3][3];
471 m.flagBits = QDoubleMatrix4x4::General;
478 m.m[0][0] = m1.m[0][0] - m2.m[0][0];
479 m.m[0][1] = m1.m[0][1] - m2.m[0][1];
480 m.m[0][2] = m1.m[0][2] - m2.m[0][2];
481 m.m[0][3] = m1.m[0][3] - m2.m[0][3];
482 m.m[1][0] = m1.m[1][0] - m2.m[1][0];
483 m.m[1][1] = m1.m[1][1] - m2.m[1][1];
484 m.m[1][2] = m1.m[1][2] - m2.m[1][2];
485 m.m[1][3] = m1.m[1][3] - m2.m[1][3];
486 m.m[2][0] = m1.m[2][0] - m2.m[2][0];
487 m.m[2][1] = m1.m[2][1] - m2.m[2][1];
488 m.m[2][2] = m1.m[2][2] - m2.m[2][2];
489 m.m[2][3] = m1.m[2][3] - m2.m[2][3];
490 m.m[3][0] = m1.m[3][0] - m2.m[3][0];
491 m.m[3][1] = m1.m[3][1] - m2.m[3][1];
492 m.m[3][2] = m1.m[3][2] - m2.m[3][2];
493 m.m[3][3] = m1.m[3][3] - m2.m[3][3];
494 m.flagBits = QDoubleMatrix4x4::General;
500 int flagBits = m1.flagBits | m2.flagBits;
501 if (flagBits < QDoubleMatrix4x4::Rotation2D) {
503 m.m[3][0] +=
m.m[0][0] * m2.m[3][0];
504 m.m[3][1] +=
m.m[1][1] * m2.m[3][1];
505 m.m[3][2] +=
m.m[2][2] * m2.m[3][2];
507 m.m[0][0] *= m2.m[0][0];
508 m.m[1][1] *= m2.m[1][1];
509 m.m[2][2] *= m2.m[2][2];
510 m.flagBits = flagBits;
515 m.m[0][0] = m1.m[0][0] * m2.m[0][0]
516 + m1.m[1][0] * m2.m[0][1]
517 + m1.m[2][0] * m2.m[0][2]
518 + m1.m[3][0] * m2.m[0][3];
519 m.m[0][1] = m1.m[0][1] * m2.m[0][0]
520 + m1.m[1][1] * m2.m[0][1]
521 + m1.m[2][1] * m2.m[0][2]
522 + m1.m[3][1] * m2.m[0][3];
523 m.m[0][2] = m1.m[0][2] * m2.m[0][0]
524 + m1.m[1][2] * m2.m[0][1]
525 + m1.m[2][2] * m2.m[0][2]
526 + m1.m[3][2] * m2.m[0][3];
527 m.m[0][3] = m1.m[0][3] * m2.m[0][0]
528 + m1.m[1][3] * m2.m[0][1]
529 + m1.m[2][3] * m2.m[0][2]
530 + m1.m[3][3] * m2.m[0][3];
532 m.m[1][0] = m1.m[0][0] * m2.m[1][0]
533 + m1.m[1][0] * m2.m[1][1]
534 + m1.m[2][0] * m2.m[1][2]
535 + m1.m[3][0] * m2.m[1][3];
536 m.m[1][1] = m1.m[0][1] * m2.m[1][0]
537 + m1.m[1][1] * m2.m[1][1]
538 + m1.m[2][1] * m2.m[1][2]
539 + m1.m[3][1] * m2.m[1][3];
540 m.m[1][2] = m1.m[0][2] * m2.m[1][0]
541 + m1.m[1][2] * m2.m[1][1]
542 + m1.m[2][2] * m2.m[1][2]
543 + m1.m[3][2] * m2.m[1][3];
544 m.m[1][3] = m1.m[0][3] * m2.m[1][0]
545 + m1.m[1][3] * m2.m[1][1]
546 + m1.m[2][3] * m2.m[1][2]
547 + m1.m[3][3] * m2.m[1][3];
549 m.m[2][0] = m1.m[0][0] * m2.m[2][0]
550 + m1.m[1][0] * m2.m[2][1]
551 + m1.m[2][0] * m2.m[2][2]
552 + m1.m[3][0] * m2.m[2][3];
553 m.m[2][1] = m1.m[0][1] * m2.m[2][0]
554 + m1.m[1][1] * m2.m[2][1]
555 + m1.m[2][1] * m2.m[2][2]
556 + m1.m[3][1] * m2.m[2][3];
557 m.m[2][2] = m1.m[0][2] * m2.m[2][0]
558 + m1.m[1][2] * m2.m[2][1]
559 + m1.m[2][2] * m2.m[2][2]
560 + m1.m[3][2] * m2.m[2][3];
561 m.m[2][3] = m1.m[0][3] * m2.m[2][0]
562 + m1.m[1][3] * m2.m[2][1]
563 + m1.m[2][3] * m2.m[2][2]
564 + m1.m[3][3] * m2.m[2][3];
566 m.m[3][0] = m1.m[0][0] * m2.m[3][0]
567 + m1.m[1][0] * m2.m[3][1]
568 + m1.m[2][0] * m2.m[3][2]
569 + m1.m[3][0] * m2.m[3][3];
570 m.m[3][1] = m1.m[0][1] * m2.m[3][0]
571 + m1.m[1][1] * m2.m[3][1]
572 + m1.m[2][1] * m2.m[3][2]
573 + m1.m[3][1] * m2.m[3][3];
574 m.m[3][2] = m1.m[0][2] * m2.m[3][0]
575 + m1.m[1][2] * m2.m[3][1]
576 + m1.m[2][2] * m2.m[3][2]
577 + m1.m[3][2] * m2.m[3][3];
578 m.m[3][3] = m1.m[0][3] * m2.m[3][0]
579 + m1.m[1][3] * m2.m[3][1]
580 + m1.m[2][3] * m2.m[3][2]
581 + m1.m[3][3] * m2.m[3][3];
582 m.flagBits = flagBits;
614 if (
matrix.flagBits == QDoubleMatrix4x4::Identity) {
616 }
else if (
matrix.flagBits < QDoubleMatrix4x4::Rotation2D) {
621 }
else if (
matrix.flagBits < QDoubleMatrix4x4::Rotation) {
699 if (
matrix.flagBits == QDoubleMatrix4x4::Identity) {
701 }
else if (
matrix.flagBits < QDoubleMatrix4x4::Rotation2D) {
705 }
else if (
matrix.flagBits < QDoubleMatrix4x4::Perspective) {
731 if (
matrix.flagBits == QDoubleMatrix4x4::Identity) {
733 }
else if (
matrix.flagBits < QDoubleMatrix4x4::Rotation2D) {
737 }
else if (
matrix.flagBits < QDoubleMatrix4x4::Perspective) {
777 m.flagBits = QDoubleMatrix4x4::General;
784 m.m[0][0] =
matrix.m[0][0] * factor;
785 m.m[0][1] =
matrix.m[0][1] * factor;
786 m.m[0][2] =
matrix.m[0][2] * factor;
787 m.m[0][3] =
matrix.m[0][3] * factor;
788 m.m[1][0] =
matrix.m[1][0] * factor;
789 m.m[1][1] =
matrix.m[1][1] * factor;
790 m.m[1][2] =
matrix.m[1][2] * factor;
791 m.m[1][3] =
matrix.m[1][3] * factor;
792 m.m[2][0] =
matrix.m[2][0] * factor;
793 m.m[2][1] =
matrix.m[2][1] * factor;
794 m.m[2][2] =
matrix.m[2][2] * factor;
795 m.m[2][3] =
matrix.m[2][3] * factor;
796 m.m[3][0] =
matrix.m[3][0] * factor;
797 m.m[3][1] =
matrix.m[3][1] * factor;
798 m.m[3][2] =
matrix.m[3][2] * factor;
799 m.m[3][3] =
matrix.m[3][3] * factor;
800 m.flagBits = QDoubleMatrix4x4::General;
807 m.m[0][0] =
matrix.m[0][0] * factor;
808 m.m[0][1] =
matrix.m[0][1] * factor;
809 m.m[0][2] =
matrix.m[0][2] * factor;
810 m.m[0][3] =
matrix.m[0][3] * factor;
811 m.m[1][0] =
matrix.m[1][0] * factor;
812 m.m[1][1] =
matrix.m[1][1] * factor;
813 m.m[1][2] =
matrix.m[1][2] * factor;
814 m.m[1][3] =
matrix.m[1][3] * factor;
815 m.m[2][0] =
matrix.m[2][0] * factor;
816 m.m[2][1] =
matrix.m[2][1] * factor;
817 m.m[2][2] =
matrix.m[2][2] * factor;
818 m.m[2][3] =
matrix.m[2][3] * factor;
819 m.m[3][0] =
matrix.m[3][0] * factor;
820 m.m[3][1] =
matrix.m[3][1] * factor;
821 m.m[3][2] =
matrix.m[3][2] * factor;
822 m.m[3][3] =
matrix.m[3][3] * factor;
823 m.flagBits = QDoubleMatrix4x4::General;
849 return *
this * point;
854 return *
this * point;
859 return *
this * point;
864 if (flagBits < Scale) {
867 }
else if (flagBits < Rotation2D) {
898#ifndef QT_NO_DEBUG_STREAM
902#ifndef QT_NO_DATASTREAM
\inmodule QtCore\reentrant
QDoubleMatrix4x4 & operator*=(const QDoubleMatrix4x4 &other)
const double & operator()(int row, int column) const
QPoint map(const QPoint &point) const
void viewport(const QRectF &rect)
bool operator!=(const QDoubleMatrix4x4 &other) const
bool operator==(const QDoubleMatrix4x4 &other) const
QDoubleMatrix4x4 & operator-=(const QDoubleMatrix4x4 &other)
QDoubleMatrix4x4 & operator+=(const QDoubleMatrix4x4 &other)
const double * constData() const
QDoubleMatrix4x4(Qt::Initialization)
QDoubleVector3D mapVector(const QDoubleVector3D &vector) const
const double * data() const
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
constexpr bool operator!=(const timespec &t1, const timespec &t2)
constexpr timespec operator+(const timespec &t1, const timespec &t2)
constexpr timespec operator*(const timespec &t1, int mul)
constexpr timespec & operator+=(timespec &t1, const timespec &t2)
constexpr timespec operator-(const timespec &t1, const timespec &t2)
Q_POSITIONING_PRIVATE_EXPORT QDoubleMatrix4x4 operator/(const QDoubleMatrix4x4 &matrix, double divisor)
Q_POSITIONING_PRIVATE_EXPORT QDataStream & operator>>(QDataStream &, QDoubleMatrix4x4 &)
QDoubleMatrix4x4 operator+(const QDoubleMatrix4x4 &m1, const QDoubleMatrix4x4 &m2)
bool qFuzzyCompare(const QDoubleMatrix4x4 &m1, const QDoubleMatrix4x4 &m2)
Q_POSITIONING_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QDoubleMatrix4x4 &m)
QDoubleMatrix4x4 operator*(const QDoubleMatrix4x4 &m1, const QDoubleMatrix4x4 &m2)
QDoubleMatrix4x4 operator-(const QDoubleMatrix4x4 &m1, const QDoubleMatrix4x4 &m2)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
int qRound(qfloat16 d) noexcept
constexpr QMargins operator/(const QMargins &margins, int divisor)
GLenum GLsizei GLsizei GLint * values
[15]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble GLdouble top
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
GLenum GLenum GLenum GLenum GLenum scale
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
static bool translate(xcb_connection_t *connection, xcb_window_t child, xcb_window_t parent, int *x, int *y)
view viewport() -> scroll(dx, dy, deviceRect)