QRotationReading Class
The QRotationReading class represents one reading from the rotation sensor. 更多...
头文件: | #include <QRotationReading> |
qmake: | QT += sensors |
开始支持版本: | Qt 5.1 |
基类: | QSensorReading |
属性
- 1 个属性继承自 QSensorReading
- 1 个属性继承自 QObject
公有函数
void | setFromEuler(qreal x, qreal y, qreal z) |
qreal | x() const |
qreal | y() const |
qreal | z() const |
- 4 个公有函数继承自 QSensorReading
- 32 个公有函数继承自 QObject
其他继承的成员
- 1 个公有槽函数继承自 QObject
- 2 个信号继承自 QObject
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 9 个受保护的函数继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
The QRotationReading class represents one reading from the rotation sensor.
QRotationReading Units
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.
- Right-handed rotation z (-180, 180]. Starting from the y-axis and incrementing in the counter-clockwise direction.
- Right-handed rotation x [-90, 90]. Starting from the new (once-rotated) y-axis and incrementing towards the z-axis.
- Right-handed rotation y (-180, 180]. Starting from the new (twice-rotated) z-axis and incrementing towards the x-axis.
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.
属性
x : const qreal
This property holds the rotation around the x axis.
Measured as degrees.
访问函数:
qreal | x() const |
y : const qreal
This property holds the rotation around the y axis.
Measured as degrees.
访问函数:
qreal | y() const |
z : const qreal
This property holds the rotation around the z axis.
Measured as degrees.
访问函数:
qreal | z() const |
成员函数
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.