Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Inconsistency between QLineF::angle and QTransform::rotate
Forum Updated to NodeBB v4.3 + New Features

Inconsistency between QLineF::angle and QTransform::rotate

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    Does anyone know if there's a special reason for the inconsistency between QLineF::angle and QTransform::rotate?

    The former defines zero degrees at "the 3 o'clock position".

    The latter does not define the zero degree position at all (as far as 4.7 docs are concerned), but appears to use the 12 o'clock position for that.

    My guess: Two developer teams that didn't talk to each other.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      The difference is not just limited to Qt routines. It depends on the definition of your coordinate system (left-handed or right-handed).
      For QLineF apparently the definition of mathematians is used. Horizontal x- and vertical y-axis. The angle is defined starting at x-axis going to y-axis (right-handed system).
      In mapping typically a left-handed system is used. x is vertical pointing towards North and y is pointing to the East (right). The angle is again defined to start at x-axis and increasing towards y-axis.
      Transformation are typically associated with maps.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        I know there are different ways to define the coordinate system. It doesn't really provide a good argument to mix different ways in the same API, in my opinion.

        The thing that irritates me most is that the behaviour isn't even documented in QTransform::rotate, as if that was the only way to do it.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          About the documentation you are certainly right. It should be properly documented. You might want to file a report on "JIRA":https://bugreports.qt.nokia.com/secure/Dashboard.jspa .

          However, one has to be careful with adjusting the definition. One has to stay within the common rules used in mathematics and cartography. Otherwise it will end in a mess.

          BTW I have not checked, if the current definition is conform with these common rules.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            Should have checked prior to writing an answer :-(

            "under":http://doc.qt.nokia.com/4.7/qtransform.html#rotate you find this text.

            @
            Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.
            Note that if you apply a QTransform to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.
            The angle is specified in degrees.
            @

            Which means that the rotation starts at 3 o'clock, but this definition is really ackward for maps.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved