Results 1 to 2 of 2

Thread: Error in QPolygonF::subtracted

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Error in QPolygonF::subtracted

    The following code produces very different result, the only different is the precision (with "f" turn to float), can someone explain please? Many thanks!

    Qt Code:
    1. #include <QPolygonF>
    2. #include <QDebug>
    3.  
    4. int main()
    5. {
    6. QPolygonF polygon1;
    7. polygon1 << QPointF(-49.3670886075949369, 1930.1848049281315980 )
    8. << QPointF(-34.7848101265822862, 1170.4312114989734255 )
    9. << QPointF(-13.1139240506329173, 2084.1889117043124315 );
    10.  
    11. QPolygonF polygon2;
    12. polygon2 << QPointF(-41.6708860759493689, 1940.4517453798769111 )
    13. << QPointF(-52.2025316455696142, 431.2114989733059929 )
    14. << QPointF(-3.3924050632911431, 1509.2402464065710319 )
    15. << QPointF(-26.8190801175864770, 1506.3079775881415117 )
    16. << QPointF(-34.7848101265822862, 1170.4312114989734255 )
    17. << QPointF(-41.1968964968032125, 1504.5083358315471287 );
    18. qDebug() << "polygon1 - polygon2 = " << polygon1.subtracted( polygon2 );
    19.  
    20. ////////////////////
    21. QPolygonF polygon3;
    22. polygon3 << QPointF(-49.3670886075949369, 1930.1848049281315980 )
    23. << QPointF(-34.7848101265822862, 1170.4312114989734255 )
    24. << QPointF(-13.1139240506329173, 2084.1889117043124315 );
    25.  
    26. QPolygonF polygon4;
    27. polygon4 << QPointF(-41.6708860759493689f, 1940.4517453798769111f )
    28. << QPointF(-52.2025316455696142f, 431.2114989733059929f )
    29. << QPointF(-3.3924050632911431f, 1509.2402464065710319f )
    30. << QPointF(-26.8190801175864770f, 1506.3079775881415117f )
    31. << QPointF(-34.7848101265822862f, 1170.4312114989734255f )
    32. << QPointF(-41.1968964968032125f, 1504.5083358315471287f );
    33. qDebug() << "polygon3 - polygon4 = " << polygon3.subtracted( polygon4 );
    34.  
    35. ////////////////////
    36. QPolygonF polygon5;
    37. polygon5 << QPointF(-49.3670886075949369f, 1930.1848049281315980 )
    38. << QPointF(-34.7848101265822862, 1170.4312114989734255 )
    39. << QPointF(-13.1139240506329173, 2084.1889117043124315 );
    40.  
    41. QPolygonF polygon6;
    42. polygon6 << QPointF(-41.6708860759493689, 1940.4517453798769111 )
    43. << QPointF(-52.2025316455696142, 431.2114989733059929 )
    44. << QPointF(-3.3924050632911431, 1509.2402464065710319 )
    45. << QPointF(-26.8190801175864770, 1506.3079775881415117 )
    46. << QPointF(-34.7848101265822862, 1170.4312114989734255 )
    47. << QPointF(-41.1968964968032125, 1504.5083358315471287 );
    48. qDebug() << "polygon5 - polygon6 = " << polygon5.subtracted( polygon6 );
    49.  
    50. }
    To copy to clipboard, switch view to plain text mode 

    Output is:
    Qt Code:
    1. polygon1 - polygon2 = QPolygonF()
    2. polygon3 - polygon4 = QPolygonF(QPointF(-49.3671, 1930.18)QPointF(-43.7755, 1638.85)QPointF(-41.6709, 1940.45)QPointF(-41.1969, 1504.51)QPointF(-37.0334, 1287.59)QPointF(-34.7848, 1170.43)QPointF(-27.884, 1461.4)QPointF(-26.8191, 1506.31)QPointF(-26.8191, 1506.31)QPointF(-13.1139, 2084.19)QPointF(-49.3671, 1930.18))
    3. polygon5 - polygon6 = QPolygonF(QPointF(-43.7755, 1638.85)QPointF(-41.1969, 1504.51)QPointF(-41.6709, 1940.45)QPointF(-43.7755, 1638.85))
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Error in QPolygonF::subtracted

    Anyone? Suggestions? Thanks!

Similar Threads

  1. no compile error, but error on run with QMenu QAction
    By sincnarf in forum Qt Programming
    Replies: 4
    Last Post: 4th May 2011, 11:05
  2. Sorting QPolygonF
    By giusepped in forum Qt Programming
    Replies: 3
    Last Post: 7th January 2009, 08:34
  3. Replies: 1
    Last Post: 25th October 2008, 19:18
  4. qTextEdit error - clipboard error
    By bruccutler in forum Qt Programming
    Replies: 1
    Last Post: 21st May 2007, 09:21
  5. ERROR:: QPainter: Internal error; no available GC
    By Krishnacins in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2006, 06:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.