Qt Transform matrix

前端 未结 1 1138
别跟我提以往
别跟我提以往 2020-12-10 16:14

I need to manipulate QML items through QMatrix4x4, in order to apply some perspective transformations. Basically, I defined the class Transform to use an object QMatrix4x4 a

相关标签:
1条回答
  • 2020-12-10 16:46

    The math Qt is performing is correct, but the frame of reference that Qt is using doesn't match up with what you are thinking.

    Matrix Math:

    enter image description here

    So the components you are seeing in the math are adding shear in the x and y directions of image.

    But the rotation that Qt does is about one of those axis. So if you want to do a standard 2D rotation, without shearing, you need to either not specify an axis or you specify the z axis.

    The axis to rotate around. For simple (2D) rotation around a point, you do not need to specify an axis, as the default axis is the z axis (axis { x: 0; y: 0; z: 1 }).

    http://qt-project.org/doc/qt-5/qml-qtquick-rotation.html

    The rotation about the y axis looks like this:

    enter image description here

    Hope that helps.

    0 讨论(0)
提交回复
热议问题