From 61c84e2d9c46de40d22f6fafbdd23d4015025516 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 7 Feb 2014 15:30:53 +0200 Subject: Mostly revert the rotations refactor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quaternions are actually easier to use in most use cases. Added some convenience functionality for QML to enable using axis/angle combinations, too. Change-Id: I61c76e0967b4808aa9adaf43dfe6f4596c9ce353 Reviewed-by: Tomi Korpipää --- tests/qmldynamicdata/qml/qmldynamicdata/main.qml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'tests/qmldynamicdata') diff --git a/tests/qmldynamicdata/qml/qmldynamicdata/main.qml b/tests/qmldynamicdata/qml/qmldynamicdata/main.qml index 03bf4b2d..ff5ea16d 100644 --- a/tests/qmldynamicdata/qml/qmldynamicdata/main.qml +++ b/tests/qmldynamicdata/qml/qmldynamicdata/main.qml @@ -28,8 +28,8 @@ Item { ListModel { id: graphModel - ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0; rotationAxis: "1.0,1.0,1.0"; rotationAngle: 45 } - ListElement{ xPos: 1.0; yPos: 1.0; zPos: 1.0; rotationAxis: "1.0,1.0,1.0"; rotationAngle: 45 } + ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0; rotation: "0.92388, 0.220942, 0.220942, 0.220942"} + ListElement{ xPos: 1.0; yPos: 1.0; zPos: 1.0; rotation: "@45,1.0,1.0,1.0" } } Timer { @@ -38,24 +38,23 @@ Item { running: true repeat: true property bool isIncreasing: true + property real rotationAngle: 0 - function generateAngle() { - return Math.random() * 360 - } - - function generateAxis() { - return Math.random() + "," + Math.random() + "," + Math.random() + function generateQuaternion() { + return "@" + Math.random() * 360 + "," + Math.random() + "," + Math.random() + "," + Math.random() } function appendRow() { graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random(), - "rotationAxis": generateAxis(), - "rotationAngle": generateAngle()}); + "rotation": generateQuaternion() + }); } onTriggered: { + rotationAngle = rotationAngle + 1 + scatterSeries.setMeshAxisAndAngle(Qt.vector3d(1,1,1), rotationAngle) if (isIncreasing) { appendRow() appendRow() @@ -130,8 +129,7 @@ Item { xPosRole: "xPos" yPosRole: "yPos" zPosRole: "zPos" - rotationAxisRole: "rotationAxis" - rotationAngleRole: "rotationAngle" + rotationRole: "rotation" } } } -- cgit v1.2.3