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. QPolygonF error
Forum Updated to NodeBB v4.3 + New Features

QPolygonF error

Scheduled Pinned Locked Moved Unsolved General and Desktop
34 Posts 5 Posters 7.4k Views 2 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.
  • Christian EhrlicherC Christian Ehrlicher

    @kshegunov said in QPolygonF error:

    Does calling .union only once produce the correct result?

    Yes, but with slightly different numbers (not visible in a plain debug output). I would guess somewhere in the clipping logic a rounding error triggers this bug (e.g. 314.87615740 / 43.51943745 <-> 314.87600000 / 43.51940000)

    kshegunovK Offline
    kshegunovK Offline
    kshegunov
    Moderators
    wrote on last edited by kshegunov
    #25

    @Christian-Ehrlicher said in QPolygonF error:

    Yes, but with slightly different numbers (not visible in a plain debug output). I would guess somewhere in the clipping logic a rounding error triggers this bug (e.g. 314.87615740 / 43.51943745 <-> 314.87600000 / 43.51940000)

    Looks truncated more than a rounding error.

    @Daniil-S said in QPolygonF error:

    yes, but I cant check top polygons are equal, because they must be combined in order in the loop and can have different overlay types, and checking high by points before united is not entirely correct, because a polygon can contain a point, but not a union

    I was asking to discern whether the problem is that the two unions apply the same polygon only, there's a lot of edge cases whenever you're dealing with lines which are almost parallel (e.g. https://codereview.qt-project.org/c/qt/qtbase/+/292807).

    Please search the tracker and if this isn't reported, do so. Attach the minimal code to reproduce as well. Whenever I finish with that QLineF thing, given time I'll take a look.

    Read and abide by the Qt Code of Conduct

    Christian EhrlicherC D 2 Replies Last reply
    0
    • kshegunovK kshegunov

      @Christian-Ehrlicher said in QPolygonF error:

      Yes, but with slightly different numbers (not visible in a plain debug output). I would guess somewhere in the clipping logic a rounding error triggers this bug (e.g. 314.87615740 / 43.51943745 <-> 314.87600000 / 43.51940000)

      Looks truncated more than a rounding error.

      @Daniil-S said in QPolygonF error:

      yes, but I cant check top polygons are equal, because they must be combined in order in the loop and can have different overlay types, and checking high by points before united is not entirely correct, because a polygon can contain a point, but not a union

      I was asking to discern whether the problem is that the two unions apply the same polygon only, there's a lot of edge cases whenever you're dealing with lines which are almost parallel (e.g. https://codereview.qt-project.org/c/qt/qtbase/+/292807).

      Please search the tracker and if this isn't reported, do so. Attach the minimal code to reproduce as well. Whenever I finish with that QLineF thing, given time I'll take a look.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #26

      @kshegunov said in QPolygonF error:

      Looks truncated more than a rounding error.

      No error - qDebug() prints not the complete double value, I guess the values are taken from there. Mine are the exact ones :)

      So basically a polygon is united with a polygon which nearly matches parts of the first polygon which fails sometimes.

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

      kshegunovK 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @kshegunov said in QPolygonF error:

        Looks truncated more than a rounding error.

        No error - qDebug() prints not the complete double value, I guess the values are taken from there. Mine are the exact ones :)

        So basically a polygon is united with a polygon which nearly matches parts of the first polygon which fails sometimes.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #27

        @Christian-Ehrlicher said in QPolygonF error:

        So basically a polygon is united with a polygon which nearly matches parts of the first polygon which fails sometimes.

        Yes, what I imagine happens. Probably somewhere in the clip/intersection code there's some numerical instability that breaks it silently.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • kshegunovK kshegunov

          @Christian-Ehrlicher said in QPolygonF error:

          Yes, but with slightly different numbers (not visible in a plain debug output). I would guess somewhere in the clipping logic a rounding error triggers this bug (e.g. 314.87615740 / 43.51943745 <-> 314.87600000 / 43.51940000)

          Looks truncated more than a rounding error.

          @Daniil-S said in QPolygonF error:

          yes, but I cant check top polygons are equal, because they must be combined in order in the loop and can have different overlay types, and checking high by points before united is not entirely correct, because a polygon can contain a point, but not a union

          I was asking to discern whether the problem is that the two unions apply the same polygon only, there's a lot of edge cases whenever you're dealing with lines which are almost parallel (e.g. https://codereview.qt-project.org/c/qt/qtbase/+/292807).

          Please search the tracker and if this isn't reported, do so. Attach the minimal code to reproduce as well. Whenever I finish with that QLineF thing, given time I'll take a look.

          D Offline
          D Offline
          Daniil S.
          wrote on last edited by Daniil S.
          #28

          @kshegunov yes, it only happens if two identical polygons are combine.
          here i think, is what is needed

          kshegunovK 1 Reply Last reply
          1
          • D Daniil S.

            @kshegunov yes, it only happens if two identical polygons are combine.
            here i think, is what is needed

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by kshegunov
            #29

            lol. "Out of scope" ... what can I say ...

            I suggest you open a new one, attach the reproducing code (the minimal one that @Christian-Ehrlicher insisted on), and put in the:
            "Relates to ..." field in JIRA QTBUG-38037, as it does indeed seem related.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            2
            • D Offline
              D Offline
              Daniil S.
              wrote on last edited by
              #30

              https://bugreports.qt.io/browse/QTBUG-100172

              1 Reply Last reply
              3
              • kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by kshegunov
                #31

                As I was looking into this, I also opened:

                https://bugreports.qt.io/browse/QTBUG-100302

                Read and abide by the Qt Code of Conduct

                D 2 Replies Last reply
                2
                • kshegunovK kshegunov

                  As I was looking into this, I also opened:

                  https://bugreports.qt.io/browse/QTBUG-100302

                  D Offline
                  D Offline
                  Daniil S.
                  wrote on last edited by
                  #32

                  @kshegunov I noticed it, but thought that I did something wrong

                  1 Reply Last reply
                  0
                  • kshegunovK kshegunov

                    As I was looking into this, I also opened:

                    https://bugreports.qt.io/browse/QTBUG-100302

                    D Offline
                    D Offline
                    Daniil S.
                    wrote on last edited by
                    #33

                    @kshegunov probably, as advised in one of the reports, I will use the clipper library

                    kshegunovK 1 Reply Last reply
                    0
                    • D Daniil S.

                      @kshegunov probably, as advised in one of the reports, I will use the clipper library

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by kshegunov
                      #34

                      @Daniil-S said in QPolygonF error:

                      @kshegunov probably, as advised in one of the reports, I will use the clipper library

                      Yes, that's prudent as even if I have the time and will to fix at least some of this, assuming it gets accepted to begin with, it can be a long time.

                      Read and abide by the Qt Code of Conduct

                      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