qtmobility/src/sensors/qrotationsensor.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    53     \preliminary
    53     \preliminary
    54     \brief The QRotationReading class represents one reading from the
    54     \brief The QRotationReading class represents one reading from the
    55            rotation sensor.
    55            rotation sensor.
    56 
    56 
    57     \section2 QRotationReading Units
    57     \section2 QRotationReading Units
    58     The rotation sensor returns the rotation of the device along the X, Y and Z
    58 
    59     axes. The scale of the values is radians. The axes are arranged as follows.
    59     The rotation reading contains 3 angles, measured in degrees that define the orientation
    60 
    60     of the device in three-dimensional space. The three angles are applied to the device in the
    61 \code
    61     following order.
    62              +z
    62 
    63               |
    63     \list
    64               |      +y
    64     \o Right-handed rotation z (-180, 180]. Starting from the x axis and incrementing towards the
    65               |     /
    65        y axis.
    66               |----/----
    66     \o Right-handed rotation x (-90, 90]. Starting from the new (once-rotated) y axis and
    67              /| NOKIA  /|
    67        incrementing towards the z axis.
    68             //|--/--- / |
    68     \o Right-handed rotation y (-180, 180]. Starting from the new (twice-rotated) z axis and
    69            // | /   //  /
    69        incrementing towards the x axis.
    70           //  |/   //  /
    70     \endlist
    71          //   '--------------- +x
    71 
    72         //       //  /
    72     \image Rotation_angles.png Visual representation of the rotation angles.
    73        //       //  /
    73 
    74       /---------/  /
    74     The 0 point for the z angle is defined as a fixed, external entity and is device-specific. While magnetic
    75      /    O    /  /
    75     north is typically used as this reference point it may not be. Do not attempt to compare values
    76     /         /  /
    76     for the z angle between devices or even on the same device if it has moved a significant distance.
    77     ----------  /
    77     If the device cannot detect a fixed, external entity the z angle will always be 0 and the
    78     |_________!/
    78     QRotationSensor::hasZ property will be set to false.
    79 \endcode
    79 
    80 
    80     The 0 point for the x and y angles are defined as when the x and y axes of the device are oriented
    81     Note that the values for the rotation sensor come from an accelerometer
    81     towards the horizon.
    82     so a device resting on its back will not be able to detect rotation around the
       
    83     Z axis. Rotation can only be detected when it happens relative to gravity.
       
    84 */
    82 */
    85 
    83 
    86 /*!
    84 /*!
    87     \property QRotationReading::x
    85     \property QRotationReading::x
    88     \brief the rotation on the X axis.
    86     \brief the rotation around the x axis.
    89 
    87 
    90     Measured as radians.
    88     Measured as degrees.
    91     \sa {QRotationReading Units}
    89     \sa {QRotationReading Units}
    92 */
    90 */
    93 
    91 
    94 qreal QRotationReading::x() const
    92 qreal QRotationReading::x() const
    95 {
    93 {
    96     return d->x;
    94     return d->x;
    97 }
    95 }
    98 
    96 
    99 /*!
    97 /*!
   100     Sets the rotation on the X axis to \a x.
    98     Sets the rotation around the x axis to \a x.
   101 */
    99 */
   102 void QRotationReading::setX(qreal x)
   100 void QRotationReading::setX(qreal x)
   103 {
   101 {
   104     d->x = x;
   102     d->x = x;
   105 }
   103 }
   106 
   104 
   107 /*!
   105 /*!
   108     \property QRotationReading::y
   106     \property QRotationReading::y
   109     \brief the rotation on the Y axis.
   107     \brief the rotation around the y axis.
   110 
   108 
   111     Measured as radians.
   109     Measured as degrees.
   112     \sa {QRotationReading Units}
   110     \sa {QRotationReading Units}
   113 */
   111 */
   114 
   112 
   115 qreal QRotationReading::y() const
   113 qreal QRotationReading::y() const
   116 {
   114 {
   117     return d->y;
   115     return d->y;
   118 }
   116 }
   119 
   117 
   120 /*!
   118 /*!
   121     Sets the rotation on the Y axis to \a y.
   119     Sets the rotation around the y axis to \a y.
   122 */
   120 */
   123 void QRotationReading::setY(qreal y)
   121 void QRotationReading::setY(qreal y)
   124 {
   122 {
   125     d->y = y;
   123     d->y = y;
   126 }
   124 }
   127 
   125 
   128 /*!
   126 /*!
   129     \property QRotationReading::z
   127     \property QRotationReading::z
   130     \brief the rotation on the Z axis.
   128     \brief the rotation around the z axis.
   131 
   129 
   132     Measured as radians.
   130     Measured as degrees.
   133     \sa {QRotationReading Units}
   131     \sa {QRotationReading Units}
   134 */
   132 */
   135 
   133 
   136 qreal QRotationReading::z() const
   134 qreal QRotationReading::z() const
   137 {
   135 {
   138     return d->z;
   136     return d->z;
   139 }
   137 }
   140 
   138 
   141 /*!
   139 /*!
   142     Sets the rotation on the Z axis to \a z.
   140     Sets the rotation around the z axis to \a z.
   143 */
   141 */
   144 void QRotationReading::setZ(qreal z)
   142 void QRotationReading::setZ(qreal z)
   145 {
   143 {
   146     d->z = z;
   144     d->z = z;
   147 }
   145 }
   148 
   146 
   149 // =====================================================================
   147 // =====================================================================
   150 
       
   151 // begin generated code
       
   152 
   148 
   153 /*!
   149 /*!
   154     \class QRotationFilter
   150     \class QRotationFilter
   155     \ingroup sensors_filter
   151     \ingroup sensors_filter
   156 
   152 
   204 
   200 
   205     Returns the reading class for this sensor.
   201     Returns the reading class for this sensor.
   206 
   202 
   207     \sa QSensor::reading()
   203     \sa QSensor::reading()
   208 */
   204 */
   209 // end generated code
   205 
       
   206 /*!
       
   207     \property QRotationSensor::hasZ
       
   208     \brief a value indicating if the z angle is available.
       
   209 
       
   210     Returns true if z is available.
       
   211     Returns false if z is not available.
       
   212 */
   210 
   213 
   211 #include "moc_qrotationsensor.cpp"
   214 #include "moc_qrotationsensor.cpp"
   212 QTM_END_NAMESPACE
   215 QTM_END_NAMESPACE
   213 
   216