5#include <QtCore/qmath.h>
6#include <QtCore/qvariant.h>
7#include <QtGui/qtransform.h>
13#ifndef QT_NO_MATRIX4X4
70 for (
int col = 0; col < 4; ++col)
116 for (
int col = 0; col < 4; ++col) {
118 if (col < cols &&
row < rows)
245static inline double matrixDet2(
const double m[4][4],
int col0,
int col1,
int row0,
int row1)
247 return m[col0][row0] *
m[col1][row1] -
m[col0][row1] *
m[col1][row0];
261 (
const double m[4][4],
int col0,
int col1,
int col2,
262 int row0,
int row1,
int row2)
264 return m[col0][row0] *
matrixDet2(
m, col1, col2, row1, row2)
266 +
m[col2][row0] *
matrixDet2(
m, col0, col1, row1, row2);
282 for (
int i = 0;
i < 4; ++
i)
283 for (
int j = 0;
j < 4; ++
j)
284 mm[
i][
j] =
double(
m[
i][
j]);
298 return mm[0][0] * mm[1][1] * mm[2][2];
325 inv.m[3][0] = -
m[3][0];
326 inv.m[3][1] = -
m[3][1];
327 inv.m[3][2] = -
m[3][2];
334 if (
m[0][0] == 0 ||
m[1][1] == 0 ||
m[2][2] == 0) {
340 inv.m[0][0] = 1.0f /
m[0][0];
341 inv.m[1][1] = 1.0f /
m[1][1];
342 inv.m[2][2] = 1.0f /
m[2][2];
343 inv.m[3][0] = -
m[3][0] * inv.m[0][0];
344 inv.m[3][1] = -
m[3][1] * inv.m[1][1];
345 inv.m[3][2] = -
m[3][2] * inv.m[2][2];
346 inv.flagBits = flagBits;
354 return orthonormalInverse();
361 double det =
matrixDet3(mm, 0, 1, 2, 0, 1, 2);
369 inv.m[0][0] =
matrixDet2(mm, 1, 2, 1, 2) * det;
370 inv.m[0][1] = -
matrixDet2(mm, 0, 2, 1, 2) * det;
371 inv.m[0][2] =
matrixDet2(mm, 0, 1, 1, 2) * det;
373 inv.m[1][0] = -
matrixDet2(mm, 1, 2, 0, 2) * det;
374 inv.m[1][1] =
matrixDet2(mm, 0, 2, 0, 2) * det;
375 inv.m[1][2] = -
matrixDet2(mm, 0, 1, 0, 2) * det;
377 inv.m[2][0] =
matrixDet2(mm, 1, 2, 0, 1) * det;
378 inv.m[2][1] = -
matrixDet2(mm, 0, 2, 0, 1) * det;
379 inv.m[2][2] =
matrixDet2(mm, 0, 1, 0, 1) * det;
381 inv.m[3][0] = -inv.m[0][0] *
m[3][0] - inv.m[1][0] *
m[3][1] - inv.m[2][0] *
m[3][2];
382 inv.m[3][1] = -inv.m[0][1] *
m[3][0] - inv.m[1][1] *
m[3][1] - inv.m[2][1] *
m[3][2];
383 inv.m[3][2] = -inv.m[0][2] *
m[3][0] - inv.m[1][2] *
m[3][1] - inv.m[2][2] *
m[3][2];
385 inv.flagBits = flagBits;
405 inv.m[0][0] =
matrixDet3(mm, 1, 2, 3, 1, 2, 3) * det;
406 inv.m[0][1] = -
matrixDet3(mm, 0, 2, 3, 1, 2, 3) * det;
407 inv.m[0][2] =
matrixDet3(mm, 0, 1, 3, 1, 2, 3) * det;
408 inv.m[0][3] = -
matrixDet3(mm, 0, 1, 2, 1, 2, 3) * det;
409 inv.m[1][0] = -
matrixDet3(mm, 1, 2, 3, 0, 2, 3) * det;
410 inv.m[1][1] =
matrixDet3(mm, 0, 2, 3, 0, 2, 3) * det;
411 inv.m[1][2] = -
matrixDet3(mm, 0, 1, 3, 0, 2, 3) * det;
412 inv.m[1][3] =
matrixDet3(mm, 0, 1, 2, 0, 2, 3) * det;
413 inv.m[2][0] =
matrixDet3(mm, 1, 2, 3, 0, 1, 3) * det;
414 inv.m[2][1] = -
matrixDet3(mm, 0, 2, 3, 0, 1, 3) * det;
415 inv.m[2][2] =
matrixDet3(mm, 0, 1, 3, 0, 1, 3) * det;
416 inv.m[2][3] = -
matrixDet3(mm, 0, 1, 2, 0, 1, 3) * det;
417 inv.m[3][0] = -
matrixDet3(mm, 1, 2, 3, 0, 1, 2) * det;
418 inv.m[3][1] =
matrixDet3(mm, 0, 2, 3, 0, 1, 2) * det;
419 inv.m[3][2] = -
matrixDet3(mm, 0, 1, 3, 0, 1, 2) * det;
420 inv.m[3][3] =
matrixDet3(mm, 0, 1, 2, 0, 1, 2) * det;
421 inv.flagBits = flagBits;
441 if (flagBits <
Scale) {
446 if (
m[0][0] == 0.0f ||
m[1][1] == 0.0f ||
m[2][2] == 0.0f)
448 inv.
data()[0] = 1.0f /
m[0][0];
449 inv.
data()[4] = 1.0f /
m[1][1];
450 inv.
data()[8] = 1.0f /
m[2][2];
453 float *invm = inv.
data();
454 invm[0 + 0 * 3] =
m[0][0];
455 invm[1 + 0 * 3] =
m[0][1];
456 invm[2 + 0 * 3] =
m[0][2];
457 invm[0 + 1 * 3] =
m[1][0];
458 invm[1 + 1 * 3] =
m[1][1];
459 invm[2 + 1 * 3] =
m[1][2];
460 invm[0 + 2 * 3] =
m[2][0];
461 invm[1 + 2 * 3] =
m[2][1];
462 invm[2 + 2 * 3] =
m[2][2];
468 double det =
matrixDet3(mm, 0, 1, 2, 0, 1, 2);
473 float *invm = inv.
data();
476 invm[0 + 0 * 3] = (mm[1][1] * mm[2][2] - mm[2][1] * mm[1][2]) * det;
477 invm[1 + 0 * 3] = -(mm[1][0] * mm[2][2] - mm[1][2] * mm[2][0]) * det;
478 invm[2 + 0 * 3] = (mm[1][0] * mm[2][1] - mm[1][1] * mm[2][0]) * det;
479 invm[0 + 1 * 3] = -(mm[0][1] * mm[2][2] - mm[2][1] * mm[0][2]) * det;
480 invm[1 + 1 * 3] = (mm[0][0] * mm[2][2] - mm[0][2] * mm[2][0]) * det;
481 invm[2 + 1 * 3] = -(mm[0][0] * mm[2][1] - mm[0][1] * mm[2][0]) * det;
482 invm[0 + 2 * 3] = (mm[0][1] * mm[1][2] - mm[0][2] * mm[1][1]) * det;
483 invm[1 + 2 * 3] = -(mm[0][0] * mm[1][2] - mm[0][2] * mm[1][0]) * det;
484 invm[2 + 2 * 3] = (mm[0][0] * mm[1][1] - mm[1][0] * mm[0][1]) * det;
496 for (
int col = 0; col < 4; ++col) {
592#ifndef QT_NO_VECTOR3D
594#if QT_DEPRECATED_SINCE(6, 1)
621#ifndef QT_NO_VECTOR4D
657#if QT_DEPRECATED_SINCE(6, 1)
759#ifndef QT_NO_VECTOR3D
772 if (flagBits <
Scale) {
815 if (flagBits <
Scale) {
849 if (flagBits <
Scale) {
890 if (flagBits <
Scale) {
921#ifndef QT_NO_VECTOR3D
942 }
else if (flagBits ==
Scale) {
943 m[3][0] =
m[0][0] * vx;
944 m[3][1] =
m[1][1] * vy;
945 m[3][2] =
m[2][2] * vz;
947 m[3][0] +=
m[0][0] * vx;
948 m[3][1] +=
m[1][1] * vy;
949 m[3][2] +=
m[2][2] * vz;
951 m[3][0] +=
m[0][0] * vx +
m[1][0] * vy;
952 m[3][1] +=
m[0][1] * vx +
m[1][1] * vy;
953 m[3][2] +=
m[2][2] * vz;
955 m[3][0] +=
m[0][0] * vx +
m[1][0] * vy +
m[2][0] * vz;
956 m[3][1] +=
m[0][1] * vx +
m[1][1] * vy +
m[2][1] * vz;
957 m[3][2] +=
m[0][2] * vx +
m[1][2] * vy +
m[2][2] * vz;
958 m[3][3] +=
m[0][3] * vx +
m[1][3] * vy +
m[2][3] * vz;
980 }
else if (flagBits ==
Scale) {
981 m[3][0] =
m[0][0] *
x;
982 m[3][1] =
m[1][1] *
y;
984 m[3][0] +=
m[0][0] *
x;
985 m[3][1] +=
m[1][1] *
y;
987 m[3][0] +=
m[0][0] *
x +
m[1][0] *
y;
988 m[3][1] +=
m[0][1] *
x +
m[1][1] *
y;
990 m[3][0] +=
m[0][0] *
x +
m[1][0] *
y;
991 m[3][1] +=
m[0][1] *
x +
m[1][1] *
y;
992 m[3][2] +=
m[0][2] *
x +
m[1][2] *
y;
993 m[3][3] +=
m[0][3] *
x +
m[1][3] *
y;
1016 }
else if (flagBits ==
Scale) {
1017 m[3][0] =
m[0][0] *
x;
1018 m[3][1] =
m[1][1] *
y;
1019 m[3][2] =
m[2][2] *
z;
1021 m[3][0] +=
m[0][0] *
x;
1022 m[3][1] +=
m[1][1] *
y;
1023 m[3][2] +=
m[2][2] *
z;
1025 m[3][0] +=
m[0][0] *
x +
m[1][0] *
y;
1026 m[3][1] +=
m[0][1] *
x +
m[1][1] *
y;
1027 m[3][2] +=
m[2][2] *
z;
1029 m[3][0] +=
m[0][0] *
x +
m[1][0] *
y +
m[2][0] *
z;
1030 m[3][1] +=
m[0][1] *
x +
m[1][1] *
y +
m[2][1] *
z;
1031 m[3][2] +=
m[0][2] *
x +
m[1][2] *
y +
m[2][2] *
z;
1032 m[3][3] +=
m[0][3] *
x +
m[1][3] *
y +
m[2][3] *
z;
1037#ifndef QT_NO_VECTOR3D
1068 }
else if (
angle == -90.0f ||
angle == 270.0f) {
1071 }
else if (
angle == 180.0f ||
angle == -180.0f) {
1086 m[0][0] = (tmp =
m[0][0]) *
c +
m[1][0] *
s;
1087 m[1][0] =
m[1][0] *
c - tmp *
s;
1088 m[0][1] = (tmp =
m[0][1]) *
c +
m[1][1] *
s;
1089 m[1][1] =
m[1][1] *
c - tmp *
s;
1090 m[0][2] = (tmp =
m[0][2]) *
c +
m[1][2] *
s;
1091 m[1][2] =
m[1][2] *
c - tmp *
s;
1092 m[0][3] = (tmp =
m[0][3]) *
c +
m[1][3] *
s;
1093 m[1][3] =
m[1][3] *
c - tmp *
s;
1098 }
else if (
z == 0.0f) {
1103 m[2][0] = (tmp =
m[2][0]) *
c +
m[0][0] *
s;
1104 m[0][0] =
m[0][0] *
c - tmp *
s;
1105 m[2][1] = (tmp =
m[2][1]) *
c +
m[0][1] *
s;
1106 m[0][1] =
m[0][1] *
c - tmp *
s;
1107 m[2][2] = (tmp =
m[2][2]) *
c +
m[0][2] *
s;
1108 m[0][2] =
m[0][2] *
c - tmp *
s;
1109 m[2][3] = (tmp =
m[2][3]) *
c +
m[0][3] *
s;
1110 m[0][3] =
m[0][3] *
c - tmp *
s;
1115 }
else if (
y == 0.0f &&
z == 0.0f) {
1120 m[1][0] = (tmp =
m[1][0]) *
c +
m[2][0] *
s;
1121 m[2][0] =
m[2][0] *
c - tmp *
s;
1122 m[1][1] = (tmp =
m[1][1]) *
c +
m[2][1] *
s;
1123 m[2][1] =
m[2][1] *
c - tmp *
s;
1124 m[1][2] = (tmp =
m[1][2]) *
c +
m[2][2] *
s;
1125 m[2][2] =
m[2][2] *
c - tmp *
s;
1126 m[1][3] = (tmp =
m[1][3]) *
c +
m[2][3] *
s;
1127 m[2][3] =
m[2][3] *
c - tmp *
s;
1133 double len = double(
x) * double(
x) +
1134 double(
y) * double(
y) +
1135 double(
z) * double(
z);
1138 x = float(
double(
x) /
len);
1139 y = float(
double(
y) /
len);
1140 z = float(
double(
z) /
len);
1142 float ic = 1.0f -
c;
1144 rot.m[0][0] =
x *
x * ic +
c;
1145 rot.m[1][0] =
x *
y * ic -
z *
s;
1146 rot.m[2][0] =
x *
z * ic +
y *
s;
1148 rot.m[0][1] =
y *
x * ic +
z *
s;
1149 rot.m[1][1] =
y *
y * ic +
c;
1150 rot.m[2][1] =
y *
z * ic -
x *
s;
1152 rot.m[0][2] =
x *
z * ic -
y *
s;
1153 rot.m[1][2] =
y *
z * ic +
x *
s;
1154 rot.m[2][2] =
z *
z * ic +
c;
1180 }
else if (
angle == -90.0f ||
angle == 270.0f) {
1183 }
else if (
angle == 180.0f ||
angle == -180.0f) {
1192 const qreal d = 1.0 / distanceToPlane;
1200 m[0][0] = (tmp =
m[0][0]) *
c +
m[1][0] *
s;
1201 m[1][0] =
m[1][0] *
c - tmp *
s;
1202 m[0][1] = (tmp =
m[0][1]) *
c +
m[1][1] *
s;
1203 m[1][1] =
m[1][1] *
c - tmp *
s;
1204 m[0][2] = (tmp =
m[0][2]) *
c +
m[1][2] *
s;
1205 m[1][2] =
m[1][2] *
c - tmp *
s;
1206 m[0][3] = (tmp =
m[0][3]) *
c +
m[1][3] *
s;
1207 m[1][3] =
m[1][3] *
c - tmp *
s;
1212 }
else if (
z == 0.0f) {
1217 m[0][0] =
m[0][0] *
c +
m[3][0] *
s;
1218 m[0][1] =
m[0][1] *
c +
m[3][1] *
s;
1219 m[0][2] =
m[0][2] *
c +
m[3][2] *
s;
1220 m[0][3] =
m[0][3] *
c +
m[3][3] *
s;
1224 }
else if (
y == 0.0f &&
z == 0.0f) {
1229 m[1][0] =
m[1][0] *
c -
m[3][0] *
s;
1230 m[1][1] =
m[1][1] *
c -
m[3][1] *
s;
1231 m[1][2] =
m[1][2] *
c -
m[3][2] *
s;
1232 m[1][3] =
m[1][3] *
c -
m[3][3] *
s;
1236 double len = double(
x) * double(
x) +
1237 double(
y) * double(
y) +
1238 double(
z) * double(
z);
1241 x = float(
double(
x) /
len);
1242 y = float(
double(
y) /
len);
1243 z = float(
double(
z) /
len);
1245 const float ic = 1.0f -
c;
1247 rot.m[0][0] =
x *
x * ic +
c;
1248 rot.m[1][0] =
x *
y * ic -
z *
s;
1251 rot.m[0][1] =
y *
x * ic +
z *
s;
1252 rot.m[1][1] =
y *
y * ic +
c;
1259 rot.m[0][3] = (
x *
z * ic -
y *
s) * -
d;
1260 rot.m[1][3] = (
y *
z * ic +
x *
s) * -
d;
1267#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
1294#ifndef QT_NO_QUATERNION
1310 const float f2x = quaternion.
x() + quaternion.
x();
1311 const float f2y = quaternion.
y() + quaternion.
y();
1312 const float f2z = quaternion.
z() + quaternion.
z();
1313 const float f2xw = f2x * quaternion.
scalar();
1314 const float f2yw = f2y * quaternion.
scalar();
1315 const float f2zw = f2z * quaternion.
scalar();
1316 const float f2xx = f2x * quaternion.
x();
1317 const float f2xy = f2x * quaternion.
y();
1318 const float f2xz = f2x * quaternion.
z();
1319 const float f2yy = f2y * quaternion.
y();
1320 const float f2yz = f2y * quaternion.
z();
1321 const float f2zz = f2z * quaternion.
z();
1323 m.m[0][0] = 1.0f - (f2yy + f2zz);
1324 m.m[1][0] = f2xy - f2zw;
1325 m.m[2][0] = f2xz + f2yw;
1327 m.m[0][1] = f2xy + f2zw;
1328 m.m[1][1] = 1.0f - (f2xx + f2zz);
1329 m.m[2][1] = f2yz - f2xw;
1331 m.m[0][2] = f2xz - f2yw;
1332 m.m[1][2] = f2yz + f2xw;
1333 m.m[2][2] = 1.0f - (f2xx + f2yy);
1394 const float clip = farPlane - nearPlane;
1396 m.m[0][0] = 2.0f /
width;
1401 m.m[1][1] = 2.0f / invheight;
1406 m.m[2][2] = -2.0f / clip;
1407 m.m[3][2] = -(nearPlane + farPlane) / clip;
1436 const float clip = farPlane - nearPlane;
1437 m.m[0][0] = 2.0f * nearPlane /
width;
1442 m.m[1][1] = 2.0f * nearPlane / invheight;
1447 m.m[2][2] = -(nearPlane + farPlane) / clip;
1448 m.m[3][2] = -2.0f * nearPlane * farPlane / clip;
1472 if (nearPlane == farPlane || aspectRatio == 0.0f)
1478 const float sine = std::sin(radians);
1481 float cotan = std::cos(radians) / sine;
1482 float clip = farPlane - nearPlane;
1483 m.m[0][0] = cotan / aspectRatio;
1493 m.m[2][2] = -(nearPlane + farPlane) / clip;
1494 m.m[3][2] = -(2.0f * nearPlane * farPlane) / clip;
1505#ifndef QT_NO_VECTOR3D
1527 m.m[0][0] = side.
x();
1528 m.m[1][0] = side.
y();
1529 m.m[2][0] = side.
z();
1531 m.m[0][1] = upVector.
x();
1532 m.m[1][1] = upVector.
y();
1533 m.m[2][1] = upVector.
z();
1535 m.m[0][2] = -forward.
x();
1536 m.m[1][2] = -forward.
y();
1537 m.m[2][2] = -forward.
z();
1572 const float w2 =
width / 2.0f;
1573 const float h2 =
height / 2.0f;
1586 m.m[2][2] = (farPlane - nearPlane) / 2.0f;
1587 m.m[3][2] = (nearPlane + farPlane) / 2.0f;
1636 for (
int col = 0; col < 4; ++col)
1652 m[1][0],
m[1][1],
m[1][3],
1653 m[3][0],
m[3][1],
m[3][3]);
1673 if (distanceToPlane == 1024.0f) {
1678 }
else if (distanceToPlane != 0.0f) {
1686 float d = 1.0f / distanceToPlane;
1688 m[1][0],
m[1][1],
m[1][3] -
m[1][2] *
d,
1689 m[3][0],
m[3][1],
m[3][3] -
m[3][2] *
d);
1693 m[1][0],
m[1][1],
m[1][3],
1694 m[3][0],
m[3][1],
m[3][3]);
1716#ifndef QT_NO_VECTOR3D
1743#ifndef QT_NO_VECTOR4D
1766 if (flagBits <
Scale) {
1773 float x =
rect.x() *
m[0][0] +
m[3][0];
1774 float y =
rect.y() *
m[1][1] +
m[3][1];
1775 float w =
rect.width() *
m[0][0];
1776 float h =
rect.height() *
m[1][1];
1799 return QRect(xmin, ymin, xmax - xmin, ymax - ymin);
1812 if (flagBits <
Scale) {
1814 return rect.translated(
m[3][0],
m[3][1]);
1817 float x =
rect.x() *
m[0][0] +
m[3][0];
1818 float y =
rect.y() *
m[1][1] +
m[3][1];
1819 float w =
rect.width() *
m[0][0];
1820 float h =
rect.height() *
m[1][1];
1871QMatrix4x4 QMatrix4x4::orthonormalInverse()
const
1896 result.flagBits = flagBits;
1925 if (
m[0][3] != 0 ||
m[1][3] != 0 ||
m[2][3] != 0 ||
m[3][3] != 1)
1928 flagBits &= ~Perspective;
1931 if (
m[3][0] == 0 &&
m[3][1] == 0 &&
m[3][2] == 0)
1932 flagBits &= ~Translation;
1935 if (!
m[0][2] && !
m[1][2] && !
m[2][0] && !
m[2][1]) {
1936 flagBits &= ~Rotation;
1938 if (!
m[0][1] && !
m[1][0]) {
1939 flagBits &= ~Rotation2D;
1941 if (
m[0][0] == 1 &&
m[1][1] == 1 &&
m[2][2] == 1)
1948 double lenX = mm[0][0] * mm[0][0] + mm[0][1] * mm[0][1];
1949 double lenY = mm[1][0] * mm[1][0] + mm[1][1] * mm[1][1];
1950 double lenZ = mm[2][2];
1961 double det =
matrixDet3(mm, 0, 1, 2, 0, 1, 2);
1962 double lenX = mm[0][0] * mm[0][0] + mm[0][1] * mm[0][1] + mm[0][2] * mm[0][2];
1963 double lenY = mm[1][0] * mm[1][0] + mm[1][1] * mm[1][1] + mm[1][2] * mm[1][2];
1964 double lenZ = mm[2][0] * mm[2][0] + mm[2][1] * mm[2][1] + mm[2][2] * mm[2][2];
1981#ifndef QT_NO_DEBUG_STREAM
1994 bits +=
"Translation,";
1998 bits +=
"Rotation2D,";
2000 bits +=
"Rotation,";
2002 bits +=
"Perspective,";
2007 dbg.nospace() <<
"QMatrix4x4(type:" <<
bits.constData() <<
Qt::endl
2009 <<
m(0, 0) <<
m(0, 1) <<
m(0, 2) <<
m(0, 3) <<
Qt::endl
2010 <<
m(1, 0) <<
m(1, 1) <<
m(1, 2) <<
m(1, 3) <<
Qt::endl
2011 <<
m(2, 0) <<
m(2, 1) <<
m(2, 2) <<
m(2, 3) <<
Qt::endl
2012 <<
m(3, 0) <<
m(3, 1) <<
m(3, 2) <<
m(3, 3) <<
Qt::endl
2019#ifndef QT_NO_DATASTREAM
2034 for (
int col = 0; col < 4; ++col)
2053 for (
int col = 0; col < 4; ++col) {
\inmodule QtCore\reentrant
T * data()
Returns a pointer to the raw data of this matrix.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
QMatrix3x3 normalMatrix() const
Returns the normal matrix corresponding to this 4x4 transformation.
void frustum(float left, float right, float bottom, float top, float nearPlane, float farPlane)
Multiplies this matrix by another that applies a perspective frustum projection for a window with low...
void lookAt(const QVector3D &eye, const QVector3D ¢er, const QVector3D &up)
Multiplies this matrix by a viewing matrix derived from an eye point.
void copyDataTo(float *values) const
Retrieves the 16 items in this matrix and copies them to values in row-major order.
QMatrix4x4()
Constructs an identity matrix.
void rotate(float angle, const QVector3D &vector)
Multiples this matrix by another that rotates coordinates through angle degrees about vector.
void scale(const QVector3D &vector)
Multiplies this matrix by another that scales coordinates by the components of vector.
void projectedRotate(float angle, float x, float y, float z, float distanceToPlane=1024.0)
QMatrix4x4 & operator/=(float divisor)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QMatrix4x4 transposed() const
Returns this matrix, transposed about its diagonal.
void ortho(const QRect &rect)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QTransform toTransform() const
Returns the conventional Qt 2D transformation matrix that corresponds to this matrix.
friend Q_GUI_EXPORT 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 compari...
void perspective(float verticalAngle, float aspectRatio, float nearPlane, float farPlane)
Multiplies this matrix by another that applies a perspective projection.
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...
QMatrix4x4 inverted(bool *invertible=nullptr) const
Returns the inverse of this matrix.
double determinant() const
Returns the determinant of this matrix.
void viewport(const QRectF &rect)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void optimize()
Optimize the usage of this matrix from its current elements.
void translate(const QVector3D &vector)
Multiplies this matrix by another that translates coordinates by the components of vector.
\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.
The QQuaternion class represents a quaternion consisting of a vector and scalar.
float z() const
Returns the z coordinate of this quaternion's vector.
float scalar() const
Returns the scalar component of this quaternion.
float x() const
Returns the x coordinate of this quaternion's vector.
float y() const
Returns the y coordinate of this quaternion's vector.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
The QVector3D class represents a vector or vertex in 3D space.
QVector3D normalized() const noexcept
Returns the normalized unit vector form of this vector.
constexpr float y() const noexcept
Returns the y coordinate of this point.
constexpr float x() const noexcept
Returns the x coordinate of this point.
static constexpr QVector3D crossProduct(QVector3D v1, QVector3D v2) noexcept
Returns the cross-product of vectors v1 and v2, which is normal to the plane spanned by v1 and v2.
void normalize() noexcept
Normalizes the current vector in place.
constexpr float z() const noexcept
Returns the z coordinate of this point.
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
constexpr Initialization Uninitialized
QTextStream & endl(QTextStream &stream)
Writes '\n' to the stream and flushes the stream.
bool qFuzzyIsNull(qfloat16 f) noexcept
bool qIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
constexpr QMargins operator/(const QMargins &margins, int divisor)
constexpr float qDegreesToRadians(float degrees)
static double matrixDet4(const double m[4][4])
bool qFuzzyCompare(const QMatrix4x4 &m1, const QMatrix4x4 &m2)
static void copyToDoubles(const float m[4][4], double mm[4][4])
static const float inv_dist_to_plane
QDataStream & operator>>(QDataStream &stream, QMatrix4x4 &matrix)
QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
static double matrixDet2(const double m[4][4], int col0, int col1, int row0, int row1)
static double matrixDet3(const double m[4][4], int col0, int col1, int col2, int row0, int row1, int row2)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
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
GLboolean GLboolean GLboolean GLboolean a
[7]
GLdouble GLdouble GLdouble GLdouble top
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble GLdouble w2
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
GLenum GLenum GLsizei void * row
QTextStreamManipulator qSetFieldWidth(int width)