Results 1 to 12 of 12

Thread: QPolygonF precision?! is it possible?!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QPolygonF precision?! is it possible?!

    I have this QPolygonF

    Qt Code:
    1. selectedPolygon<< QPointF(1.47 ,52.21);
    2. selectedPolygon<< QPointF(1.50 ,53.12);
    3. selectedPolygon<< QPointF(1.52 ,54.48);
    4. selectedPolygon<< QPointF(1.55,55.84);
    5. selectedPolygon<< QPointF(1.57 ,57.20);
    6. selectedPolygon<< QPointF(1.60 ,58.57);
    7. .....................................
    8. selectedPolygon<< QPointF(1.73 ,66.28);
    9. selectedPolygon<< QPointF(1.75 ,68.10);
    10. selectedPolygon<< QPointF(1.78 ,69.92);
    11. selectedPolygon<< QPointF(1.80,72.19);
    12. selectedPolygon<< QPointF(1.83 ,74.46);
    To copy to clipboard, switch view to plain text mode 

    and in debug mode when I get back these values:
    Qt Code:
    1. int N = selectedPolygon.size();
    2. for (int i = 0; i < N; i++)
    3. {
    4. x = selectedPolygon.at(i).x();
    5. y = selectedPolygon.at(i).y();
    6. ........
    7. }
    To copy to clipboard, switch view to plain text mode 

    the values comeback as:
    Qt Code:
    1. (1.47, 52.210000000000001)
    2. (1.5, 53.119999999999997)
    3. (1.52, 54.479999999999997)
    4. (1.55, 55.840000000000003)
    5. (1.5700000000000001, 57.200000000000003)
    6. .........................
    To copy to clipboard, switch view to plain text mode 

    this change causes huge errors to my calculations!!!!!!
    why is this happening? is there a way to avoid it??!
    Last edited by fatecasino; 12th January 2011 at 04:02. Reason: reformatted to look better

Similar Threads

  1. Error in QPolygonF::subtracted
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2010, 01:27
  2. Sorting QPolygonF
    By giusepped in forum Qt Programming
    Replies: 3
    Last Post: 7th January 2009, 08:34
  3. a crazy problem~~~who can help me : (
    By sunking_426 in forum Qt Programming
    Replies: 4
    Last Post: 2nd January 2009, 14:35
  4. Crazy over the QGraphicsScene/Item
    By Morea in forum Qt Programming
    Replies: 6
    Last Post: 20th November 2006, 09:18

Tags for this Thread

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.