Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83869

Correction to the documentation: https://doc.qt.io/qt-5/qtransform.html#basic-matrix-operations

    XMLWordPrintable

Details

    • df9f2fab16baa5cfaa3b1c4048b28c2413cf7af7 (qt/qtbase/6.2) 1bdd0cb3a7e507268ba0442aa01158b66b125a8f (qt/qtbase/6.1) ae2ef9dbf060ba101e32bae2b5edfed979630e30 (qt/tqtc-qtbase/dev) 262ca9816067abfee01fcf045b4ce497682bf778 (qt/tqtc-qtbase/5.15)
    • Da Vinci sprint 25, Da Vinci sprint 36, Da Vinci sprint 37

    Description

      User has a request about the documentation: https://doc.qt.io/qt-5/qtransform.html#basic-matrix-operations

      "

      The documentation above is not fully correct. For example

      the table (https://doc.qt.io/qt-5/images/qtransform-representation.png) should read more like:

      | m11 m12 m13 (dx)|
      | m21 m22 m23 (dy)|
      |.............|

      and the black box below it should read:

      x' = m11*x + m12*y + m13 (dx)
      ........

      eg for a rotation (angle t) followed by a translation

      | Cos(t) Sin(t) | . | x | + |dx|
      | -Sin(t) Cos(t) | | y | + |dy|

      ie x' = Cos(t) . x + Sin(t) . y + dx
      etc

      ie for a rotation of 45 degrees, the coefficient of y is +.7 (not -.7)
      and this can be seen to be QTransfrom.12():

      QTransform Tr;
      Tr.rotate(45);
      qreal c1 = Tr.m12(); // +.707
      qreal c2 = Tr.m21(); // -.707

      Furthermore, the text between the two eg "The m11 and m22 elements specify horizontal and vertical scaling"
      is inaccurate. m11 and m22 do not simply represent the scaling. Its more complicated than this for a general (composite) transformation.
      It would be more accurate to say that eg in the case of a pure scale do these represent the components of the scale.

      Similarly "The m31 (dx) and m32 (dy) elements specify horizontal and vertical translation" is not true in general (apart fomr the fact that m31 -> m13 and m32 -> m23)
      eg a translation followed by a rotation, see above, is not the same as vice-versa. The latter would be

      | Cos(t) Sin(t) | . | x + dx |
      | -Sin(t) Cos(t) | | y + dy |

      ie x' = Cos(t) . (x + dx) + Sin(t) . (y + dy)
      = Cos(t) . x + Cos(t) . dx + Sin(t) . y + Sin(t) . dy
      = Cos(t) . x + Sin(t) . y + ((Cos(t) . dx) + Sin(t) . dy))
      ie m13 = (Cos(t) . dx) + (Sin(t) . dy)
      and thus not simply
      m13 = dx

      "

      Attachments

        For Gerrit Dashboard: QTBUG-83869
        # Subject Branch Project Status CR V

        Activity

          People

            paulwicking Paul Wicking
            tero.pelkonen Tero Pelkonen
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes