The QRotationReading class represents one reading from the rotation sensor. More...
Header: | #include <QRotationReading> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
qmake: | QT += sensors |
Since: | Qt 5.1 |
Inherits: | QSensorReading |
void | setFromEuler(qreal x, qreal y, qreal z) |
qreal | x() const |
qreal | y() const |
qreal | z() const |
The rotation reading contains 3 angles, measured in degrees that define the orientation of the device in three-dimensional space. These angles are similar to yaw, pitch and roll but are defined using only right hand rotation with axes as defined by the right hand cartesian coordinate system.
The three angles are applied to the device in the following order.
Here is a visualization showing the order in which angles are applied.
The 0 point for the z angle is defined as a fixed, external entity and is device-specific. While magnetic North is typically used as this reference point it may not be. Do not attempt to compare values for the z angle between devices or even on the same device if it has moved a significant distance.
If the device cannot detect a fixed, external entity the z angle will always be 0 and the QRotationSensor::hasZ property will be set to false.
The 0 point for the x and y angles are defined as when the x and y axes of the device are oriented towards the horizon. Here is an example of how the x value will change with device movement.
Here is an example of how the y value will change with device movement.
Note that when x is 90 or -90, values for z and y achieve rotation around the same axis (due to the order of operations). In this case the y rotation will be 0.
[read-only]
x : const qrealThis property holds the rotation around the x axis.
Measured as degrees.
Access functions:
qreal | x() const |
See also QRotationReading Units.
[read-only]
y : const qrealThis property holds the rotation around the y axis.
Measured as degrees.
Access functions:
qreal | y() const |
See also QRotationReading Units.
[read-only]
z : const qrealThis property holds the rotation around the z axis.
Measured as degrees.
Access functions:
qreal | z() const |
See also QRotationReading Units.
[since 5.0]
void QRotationReading::setFromEuler(qreal
x, qreal y, qreal z)Sets the rotation from three euler angles.
This is to be called from the backend.
The angles are measured in degrees. The order of the rotations matters, as first the z rotation is applied, then the x rotation and finally the y rotation.
This function was introduced in Qt 5.0.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: