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

QPolygonF::intersected() incorrectly returns empty intersection

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.4.0, 5.5.0, 5.9.0 Beta 1
    • GUI: Painting
    • None

    Description

      In the following example, QPolygonF::intersected() produces a drastically incorrect result. It returns an empty intersection while in reality, polygon p1 is almost completely contained within p2 and both are quite large.

      QPolygonF p1, p2;
      
      p1 << QPointF(4830, 6297)
         << QPointF(4830, 2985.0666764423463)
         << QPointF(0, 3027.2175508956193)
         << QPointF(0, 6297);
      
      p2 << QPointF(4829.9999999999991, -326.86664711530557)
         << QPointF(4830.0000000000009, 9608.9333235576541)
         << QPointF(9.3546143180151939e-013, 9608.9333235576541)
         << QPointF(-9.3546143180151939e-013, -326.86664711530648);
      
      BOOST_CHECK(!p1.intersected(p2).isEmpty());
      

      Interestingly, swapping p1 and p2 makes the test pass:

      BOOST_CHECK(!p2.intersected(p1).isEmpty());
      

      Attachments

        Activity

          People

            sletta Gunnar Sletta
            Tulon Joseph Artsimovich
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: