qtmobility/src/sensors/qrotationsensor.cpp
changeset 8 71781823f776
parent 5 453da2cfceef
child 11 06b8e2af4411
equal deleted inserted replaced
5:453da2cfceef 8:71781823f776
    48 
    48 
    49 /*!
    49 /*!
    50     \class QRotationReading
    50     \class QRotationReading
    51     \ingroup sensors_reading
    51     \ingroup sensors_reading
    52 
    52 
    53     \preliminary
       
    54     \brief The QRotationReading class represents one reading from the
    53     \brief The QRotationReading class represents one reading from the
    55            rotation sensor.
    54            rotation sensor.
    56 
    55 
    57     \section2 QRotationReading Units
    56     \section2 QRotationReading Units
    58 
    57 
    59     The rotation reading contains 3 angles, measured in degrees that define
    58     The rotation reading contains 3 angles, measured in degrees that define
    60     the orientation of the device in three-dimensional space. The rotations
    59     the orientation of the device in three-dimensional space. These angles
    61     should not be confused with relative rotations such as yaw and pitch.
    60     are similar to yaw, pitch and roll but are defined using only right hand
    62     These rotations are of the devices axes relative to the external
    61     rotation with axes as defined by the right hand cartesian coordinate system.
    63     reference points that define the reference co-ordinate axes: X, Y and Z
    62 
    64     in the diagram.
    63     \image sensors-rotation.jpg
    65     
    64 
    66     The three angles are applied to the device in the following order.
    65     The three angles are applied to the device in the following order.
    67 
    66 
    68     \list
    67     \list
    69     \o Right-handed rotation z (-180, 180]. Starting from the x-axis and
    68     \o Right-handed rotation z (-180, 180]. Starting from the y-axis and
    70      incrementing in the direction of the y-axis.
    69      incrementing in the counter-clockwise direction.
    71     \o Right-handed rotation x [-90, 90]. Starting from the new
    70     \o Right-handed rotation x [-90, 90]. Starting from the new
    72      (once-rotated) y-axis and incrementing towards the z-axis.
    71      (once-rotated) y-axis and incrementing towards the z-axis.
    73     \o Right-handed rotation y (-180, 180]. Starting from the new
    72     \o Right-handed rotation y (-180, 180]. Starting from the new
    74      (twice-rotated) z-axis and incrementing towards the x-axis.
    73      (twice-rotated) z-axis and incrementing towards the x-axis.
    75     \endlist
    74     \endlist
    76 
    75 
    77     \image Rotation_angles.png Visual representation of the rotation angles.
    76     Here is a visualisation showing the order in which angles are applied.
       
    77 
       
    78     \image sensors-rotation-anim.gif
    78 
    79 
    79     The 0 point for the z angle is defined as a fixed, external entity and
    80     The 0 point for the z angle is defined as a fixed, external entity and
    80     is device-specific. While magnetic North is typically used as this
    81     is device-specific. While magnetic North is typically used as this
    81     reference point it may not be. Do not attempt to compare values
    82     reference point it may not be. Do not attempt to compare values
    82     for the z angle between devices or even on the same device if it has
    83     for the z angle between devices or even on the same device if it has
    83     moved a significant distance.
    84     moved a significant distance.
    84     
    85 
    85     If the device cannot detect a fixed, external entity the z angle will
    86     If the device cannot detect a fixed, external entity the z angle will
    86     always be 0 and the QRotationSensor::hasZ property will be set to false.
    87     always be 0 and the QRotationSensor::hasZ property will be set to false.
    87 
    88 
    88     The 0 point for the x and y angles are defined as when the x and y axes
    89     The 0 point for the x and y angles are defined as when the x and y axes
    89     of the device are oriented towards the horizon.
    90     of the device are oriented towards the horizon. Here is an example of
       
    91     how the x value will change with device movement.
       
    92 
       
    93     \image sensors-rotation2.jpg
       
    94 
       
    95     Here is an example of how the y value will change with device movement.
       
    96 
       
    97     \image sensors-rotation3.jpg
    90 
    98 
    91     Note that when x is 90 or -90, values for z and y achieve rotation around
    99     Note that when x is 90 or -90, values for z and y achieve rotation around
    92     the same axis (due to the order of operations). In this case the y
   100     the same axis (due to the order of operations). In this case the y
    93     rotation will be 0.
   101     rotation will be 0.
    94 */
   102 */
   160 
   168 
   161 /*!
   169 /*!
   162     \class QRotationFilter
   170     \class QRotationFilter
   163     \ingroup sensors_filter
   171     \ingroup sensors_filter
   164 
   172 
   165     \preliminary
       
   166     \brief The QRotationFilter class is a convenience wrapper around QSensorFilter.
   173     \brief The QRotationFilter class is a convenience wrapper around QSensorFilter.
   167 
   174 
   168     The only difference is that the filter() method features a pointer to QRotationReading
   175     The only difference is that the filter() method features a pointer to QRotationReading
   169     instead of QSensorReading.
   176     instead of QSensorReading.
   170 */
   177 */
   181 
   188 
   182 /*!
   189 /*!
   183     \class QRotationSensor
   190     \class QRotationSensor
   184     \ingroup sensors_type
   191     \ingroup sensors_type
   185 
   192 
   186     \preliminary
       
   187     \brief The QRotationSensor class is a convenience wrapper around QSensor.
   193     \brief The QRotationSensor class is a convenience wrapper around QSensor.
   188 
   194 
   189     The only behavioural difference is that this class sets the type properly.
   195     The only behavioural difference is that this class sets the type properly.
   190 
   196 
   191     This class also features a reading() function that returns a QRotationReading instead of a QSensorReading.
   197     This class also features a reading() function that returns a QRotationReading instead of a QSensorReading.