Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.1;
- import "Defs3D.js" as Defs3D;
- QtObject {
- id: rotation;
- property real angle : 0.0;
- property string axis : "";
- readonly property real c : Math.cos (angle * Math.PI / 180);
- readonly property real s : Math.sin (angle * Math.PI / 180);
- readonly property matrix4x4 matrix : {
- switch (axis) {
- case Defs3D.axisLeftToRight: // aka "X" in vectors
- return Qt.matrix4x4 (+1, 0, 0, 0,
- 0, +c, -s, 0,
- 0, +s, +c, 0,
- 0, 0, 0, +1);
- case Defs3D.axisBottomToTop: // aka "Y" in vectors
- return Qt.matrix4x4 (+c, 0, +s, 0,
- 0, +1, 0, 0,
- -s, 0, +c, 0,
- 0, 0, 0, +1);
- case Defs3D.axisBackToFront: // aka "Z" in vectors
- return Qt.matrix4x4 (+c, -s, 0, 0,
- +s, +c, 0, 0,
- 0, 0, 0, +1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement