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

PolygonF's intersected method return the wrong result with a specific polygon shape

    XMLWordPrintable

Details

    Description

      Hi !

      When I try to intersect those 2 polygons:

       

      QPolygonF poly1;
      QPolygonF poly2;
          
      poly1.append(QPointF(72.80599977946001, -20.0));
      poly1.append(QPointF(79.4595245353603, -20.0));
      poly1.append(QPointF(175.0, -20.0));
      poly1.append(QPointF(175.0, 20.0));
      poly1.append(QPointF(85.83632192403258, 20.0));
      poly1.append(QPointF(72.80599977946001, -20.0));
      
      poly2.append(QPointF(138.90690452319478, -20.0));
      poly2.append(QPointF(132.25337970676924, -19.999999999999996));
      poly2.append(QPointF(-175.0, -19.999999999999996));
      poly2.append(QPointF(-175.0, 20.0));
      poly2.append(QPointF(0.0, 20.0));
      poly2.append(QPointF(125.87658237835221, 20.0));
      poly2.append(QPointF(138.90690452319478, -20.0)); 

      It returns this:

       

      Blue: poly1

      Red: poly2

      Yellow: intersected polygon

       

      We can clearly see that the intesected polygon is not the polygon expected

       

      Attachments

        1. image-2024-03-21-10-15-15-015.png
          22 kB
          gael bertrand
        2. main.cpp
          0.2 kB
          gael bertrand
        3. mainwindow.cpp
          2 kB
          gael bertrand
        4. mainwindow.h
          1 kB
          gael bertrand
        5. mainwindow.ui
          0.9 kB
          gael bertrand
        6. TestIntersectPoly.pro
          0.6 kB
          gael bertrand
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bibr Andreas Aardal Hanssen
            inadvertance gael bertrand
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes