Results 1 to 3 of 3

Thread: How to calculate intersection points of a curve and a line?

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

    Default How to calculate intersection points of a curve and a line?

    Hi,

    I have a curve defined by QPolygonF and a line defined by QLineF.

    Is there a way to calculate their intersection points in Qt, as shown in the chart?

    Thanks!
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to calculate intersection points of a curve and a line?

    You can build an array of QLineF using the QPolygonF points and call QLineF::intersect for each line of array.
    A camel can go 14 days without drink,
    I can't!!!

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

    Default Re: How to calculate intersection points of a curve and a line?

    Quote Originally Posted by mcosta View Post
    You can build an array of QLineF using the QPolygonF points and call QLineF::intersect for each line of array.
    Thanks. That is what I am doing right now. It is slow. I have googled around and found so-called "sweep line algorithm", wish this would be available in Qt...

    http://www.google.com/search?q=sweep...L_enUS289US289

Similar Threads

  1. Get the points of a fitted curve
    By giusepped in forum Qwt
    Replies: 4
    Last Post: 25th December 2008, 07:42
  2. Replies: 5
    Last Post: 10th October 2008, 06:44

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.