matrix4x4 QML Value Type

매트릭스4x4 유형은 4행, 4열 매트릭스입니다. 더 보기...

상세 설명

matrix4x4 유형에는 16개의 값이 있으며, 각 값은 QML에서 m11 ~ m44 속성을 통해 액세스할 수 있습니다(행/열 순서대로). 이 유형의 값은 Qt.matrix4x4() 함수를 사용하여 구성할 수 있습니다. matrix4x4의 각 속성은 실수로 저장됩니다(ARM에서는 단정밀도, x86에서는 배정밀도).

matrix4x4 유형의 속성은 기본적으로 대각선 항목 m11, m22, m33m44 이 모두 1 이고 다른 모든 컴포넌트는 0 인 아이덴티티 행렬로 설정됩니다.

matrix4x4 유형에는 QML에서 호출할 수 있는 다음과 같은 부동형 함수가 있습니다:

함수 서명설명예제
translate(vector3d 벡터)this matrix4x4에 다음의 구성 요소로 좌표를 변환하는 다른 요소를 곱합니다. vector
var m = Qt.matrix4x4();
m.translate(Qt.vector3d(1,2,3));
console.log(m.toString());
// QMatrix4x4(1, 0, 0, 1, 0, 1, 0, 2, 0, 0, 1, 3, 0, 0, 0, 1)
rotate(실각, 벡터3d 축)this 행렬4x4에 좌표를 약 angle 도 회전하는 다른 행렬4x4를 곱합니다. axis
var m = Qt.matrix4x4();
m.rotate(180,Qt.vector3d(1,0,0));
console.log(m.toString());
// QMatrix4x4(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1)
회전(쿼터니언 쿼터니언)this 행렬4x4에 지정된 quaternion 에 따라 좌표를 회전하는 다른 행렬4x4를 곱합니다. quaternion 은 정규화된 것으로 가정합니다.
var m = Qt.matrix4x4();
m.rotate(Qt.quaternion(0.5,0.5,0.5,-0.5));
console.log(m.toString());
// QMatrix4x4(0, 1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 1)
scale(실수 인자)this 행렬4x4에 좌표의 배율을 지정된 factor
var m = Qt.matrix4x4();
m.scale(2);
console.log(m.toString());
// QMatrix4x4(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)
scale(실수 x, 실수 y, 실수 z)this 행렬4x4에 x, y, 및 z
var m = Qt.matrix4x4();
m.scale(1,2,3);
console.log(m.toString());
// QMatrix4x4(1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1)
scale(vector3d 벡터)this 행렬4x4에 다음의 구성 요소로 좌표 배율을 조정하는 다른 행렬을 곱합니다. vector
var m = Qt.matrix4x4();
m.scale(Qt.vector3d(1,2,3));
console.log(m.toString());
// QMatrix4x4(1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1)
lookAt(벡터3d 눈, 벡터3d 중심, 벡터3d 위)eye 점에서 파생된 보기 행렬에 this matrix4x4를 곱합니다. center 벡터3d는 eye 뷰가 보고 있는 뷰의 중심을 나타냅니다. up 벡터3d는 eye 에 대해 어느 방향을 위로 고려해야 하는지를 나타냅니다.
var m = Qt.matrix4x4();
m.lookAt(Qt.vector3d(1,2,3),Qt.vector3d(1,2,0),Qt.vector3d(0,1,0));
console.log(m.toString());
// QMatrix4x4(1, 0, 0, -1, 0, 1, 0, -2, 0, 0, 1, -3, 0, 0, 0, 1)
matrix4x4 times(matrix4x4 other)this matrix4x4에 other matrix4x4를 곱한 matrix4x4 결과를 반환합니다.
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
var c = a.times(b);
console.log(c.toString());
// QMatrix4x4(120, 130, 140, 150, 280, 306, 332, 358, 440, 482,
//524, 566, 600, 658, 716, 774)
벡터4배(벡터4배 벡터)vector 행렬을 this 행렬4x4에 따라 사전 벡터가 적용된 행렬로 변환한 vector4d 결과를 반환합니다.
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.vector4d(5,6,7,8);
var c = a.times(b);
console.log(c.toString()); // QVector4D(70, 174, 278, 382)
vector3d times(vector3d 벡터)vector 행렬을 this 행렬4x4에 따라 사전 벡터가 적용된 행렬로 변환한 벡터3d 결과를 반환합니다.
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.vector3d(5,6,7);
var c = a.times(b);
console.log(c.toString()); // QVector3D(0.155556, 0.437037, 0.718518)
matrix4x4 times(실수인자)this matrix4x4에 스칼라를 곱한 matrix4x4 결과를 반환합니다. factor
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = 4.48;
var c = a.times(b);
console.log(c.toString());
// QMatrix4x4(4.48, 8.96, 13.44, 17.92, 22.4, 26.88, 31.36, 35.84,
// 40.32, 44.8, 49.28, 53.76, 58.24, 62.72, 67.2, 71.68)
matrix4x4 더하기(matrix4x4 다른)this matrix4x4에 other matrix4x4를 더한 matrix4x4 결과를 반환합니다.
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
var c = a.plus(b);
console.log(c.toString());
// QMatrix4x4(6, 8, 10, 12, 14, 16, 18, 20, 22,
// 24, 26, 28, 30, 32, 34, 36)
matrix4x4 마이너스(matrix4x4 다른)this matrix4x4에서 other matrix4x4를 뺀 matrix4x4 결과를 리턴합니다.
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
var c = a.minus(b);
console.log(c.toString());
// QMatrix4x4(-4, -4, -4, -4, -4, -4, -4, -4, -4,
// -4, -4, -4, -4, -4, -4, -4)
vector4d row(int which)which 에 지정된 this 의 벡터4 행을 리턴합니다. 참고: which 는 행렬에 대한 0 기반 액세스입니다.
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.vector4d(a.m21, a.m22, a.m23, a.m24);
var c = a.row(2); // zero based access!  so not equal to b
console.log(b.toString() + " " + c.toString());
// QVector4D(5, 6, 7, 8) QVector4D(9, 10, 11, 12)
vector4d column(int which)which 에 지정된 this 의 벡터4 열을 리턴합니다. 주: which 는 행렬에 대한 0 기반 액세스입니다.
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.vector4d(a.m12, a.m22, a.m32, a.m42);
var c = a.column(2); // zero based access!  so not equal to b
console.log(b.toString() + " " + c.toString());
// QVector4D(2, 6, 10, 14) QVector4D(3, 7, 11, 15)
real determinant()this matrix4x4의 행렬식을 반환합니다.
var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
var b = a.determinant();
console.log(b); // 6
matrix4x4 inverted()this matrix4x4의 역행렬이 존재하면 역행렬을, 그렇지 않으면 행렬을 반환합니다.
var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
var b = a.inverted();
console.log(b.toString());
// QMatrix4x4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.333333, 0, -100,
// -100, -100, 1)
matrix4x4 transposed()this matrix4x4의 전치를 리턴합니다.
var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
var b = a.transposed();
console.log(b.toString());
// QMatrix4x4(1, 0, 0, 100, 0, 2, 0, 200, 0, 0, 3, 300, 0, 0, 0, 1)
rect mapRect(rect)제공된 직사각형을 이 행렬에 정의된 좌표계에 매핑합니다. 회전이나 전단이 지정된 경우, 이 함수는 경계 직사각형을 반환합니다. 이 함수는 Qt 6.5에 도입되었습니다.
var a = Qt.matrix4x4(2,0,0,0,0,2,0,0,0,0,1,0,0,0,0,1);
var b = a.mapRect(Qt.rect(10, 20, 30, 40));
console.log(b.toString());
// Qt.rect(20, 40, 60, 80)
point map(point)주어진 점을 이 행렬로 정의된 좌표계에 매핑합니다. 이 함수는 Qt 6.5에 도입되었습니다.
var a = Qt.matrix4x4(2,0,0,0,0,2,0,0,0,0,1,0,0,0,0,1);
var b = a.map(10, 20);
console.log(b.toString());
// Qt.point(20, 40)
bool fuzzyEquals(matrix4x4 other, 실수 엡실론)this matrix4x4가 other matrix4x4와 거의 같으면 참을 리턴합니다. this 의 각 속성이 other 의 각 속성의 epsilon 내에 있으면 근사치는 참이 됩니다. epsilon 은 선택적 인자이며 기본값 epsilon 은 0.00001 입니다.
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(1.0001,2.0001,3.0002,4.0003,5.0001,6.0002,
                     7.0002,8.0004, 9.0001,10.0003,
                     11.0003,12.0004,13.0001,
                     14.0002,15.0003,16.0004);
var c = a.fuzzyEquals(b);        // default epsilon
var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
console.log(c + " " + d); // false true

이 값 유형은 QtQuick 가져오기에서 제공됩니다.

QML 값 유형도참조하세요 .

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.