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. Qline:F:angle seems not correct
Forum Updated to NodeBB v4.3 + New Features

Qline:F:angle seems not correct

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 56 Views
  • 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.
  • F Offline
    F Offline
    Fen_seven
    wrote last edited by
    #1

    Hello,

    according to code
    https://codebrowser.dev/qt6/qtbase/src/corelib/tools/qline.cpp.html#_ZNK6QLineF5angleEv
    L564 angle()
    const qreal theta = qRadiansToDegrees(qAtan2(-dy, dx)); // why negative dy

    a line with point (0, 0) (0, 1) , angle() returns 270

    according to doc
    The angles are measured counter-clockwise from x axis, so the correct result should be 90.

    In my opinion, the negative sign before dy should be removed.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote last edited by
      #2

      Counter clockwise so 0 degree is right, 90 is up, 180 left and 270 down. This matches the Qt coordinate system: https://doc.qt.io/qt-6/coordsys.html

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      F 1 Reply Last reply
      2
      • Christian EhrlicherC Christian Ehrlicher

        Counter clockwise so 0 degree is right, 90 is up, 180 left and 270 down. This matches the Qt coordinate system: https://doc.qt.io/qt-6/coordsys.html

        F Offline
        F Offline
        Fen_seven
        wrote last edited by
        #3

        @Christian-Ehrlicher Thank you very much !

        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