Results 1 to 5 of 5

Thread: A accuracy problem about QPainterpath.arcTo

  1. #1
    Join Date
    Apr 2016
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Post A accuracy problem about QPainterpath.arcTo

    Hi, I have a problem when i use QPainterPath.arcTo, and it puzzls me for a long time. just as the flowing:

    r=100.1232131
    path=QPainterPath(QPointF(r, 0))
    rect=QRectF(-r, -r, 2*r, 2*r)
    path.arcTo(rect, 0.0, 78.0)
    p2=path.pointAtPercent(1.0)
    print QLineF(p2, QPointF(0, 0)).length()

    the printed r=100.143731537 not equal the one before

    is there some way to improve the accuray or does i make any mistakes in the program?

    Thanks for your suggestions and greatly appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: A accuracy problem about QPainterpath.arcTo

    Which value do you expect the p2 to have?

    Cheers,
    _

  3. #3
    Join Date
    Apr 2016
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A accuracy problem about QPainterpath.arcTo

    i expect the length of line berween p2 and center (qpoint(0,0)) equal to the r i set before, but there is some errors.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: A accuracy problem about QPainterpath.arcTo

    Well, the point that has r as its X coordinate is at the beginning of the path.
    p2 is not, you've requested it to be the position 1% into the path.

    Cheers,
    _

  5. #5
    Join Date
    Apr 2016
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A accuracy problem about QPainterpath.arcTo

    p2=path.pointAtPercent(n)

    n between 0.0 to 1.0, when n=1.0 means 100%

    rect=QRectF(-r, -r, 2*r, 2*r)
    path.arcTo(rect, 0.0, 78.0)

    it means that the path is a arc (part of a circle), and the length of each point at the arc between center(QPointF(0,0)) is equal to the r(100.1232131) set before
    but why the length between the end point of path (p2) and center is not equal to the r(100.1232131),

Similar Threads

  1. Problems with QPainterPath::arcTo()
    By brcain in forum Qt Programming
    Replies: 8
    Last Post: 4th November 2014, 23:10
  2. Angles in QPainterPath::arcTo
    By hector1984 in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2013, 05:28
  3. QPainterPath::quadTo(...) calls QPainterPath::cubicTo(...) ?
    By brucelamond in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2011, 23:30
  4. QPainterPath::arcTo accuracy
    By robertson1 in forum Qt Programming
    Replies: 0
    Last Post: 18th July 2008, 12:13
  5. QPainterPath.arcTo
    By grellsworth in forum Qt Programming
    Replies: 1
    Last Post: 18th March 2008, 17:36

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.