Commit 87940dbbe2df6cb5fd6c606a13597e4b3d9f3777
Added yaw and magnitude to QOrientationInfo.
The math needs to be verified.
| |   |
| 32 | 32 | void orientationUpdate(const QString &rotation, const QString &stand, const QString &face, int x, int y, int z); |
| 33 | 33 | |
| 34 | 34 | Q_SIGNALS: |
| void orientationChanged(qreal pitch, qreal roll); |
| void orientationChanged(qreal pitch, qreal roll, qreal yaw, qreal mag); |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | private: |
| |   |
| 53 | 53 | Q_UNUSED(stand) |
| 54 | 54 | Q_UNUSED(face) |
| 55 | 55 | |
| //TODO: check if these are correct! |
| 56 | 57 | qreal pitch = atan2(static_cast<qreal>(x), static_cast<qreal>(-y)); |
| 57 | 58 | qreal roll = atan2(static_cast<qreal>(y), static_cast<qreal>(-z)); |
| qreal yaw = atan2(static_cast<qreal>(x), static_cast<qreal>(-z)); |
| qreal mag = qSqrt(qPow(static_cast<qreal>(x), 2) + qPow(static_cast<qreal>(y), 2) + qPow(static_cast<qreal>(z), 2)); |
| 58 | 61 | |
| emit pub->orientationChanged(pitch, roll); |
| emit pub->orientationChanged(pitch, roll, yaw, mag); |
| 60 | 63 | } |
| 61 | 64 | |
| 62 | 65 | void QOrientationInfoPrivate::startListening() |