Results 1 to 4 of 4

Thread: How to obtain values of a zoomed curve ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to obtain values of a zoomed curve ?

    The function above is just a start.
    I didn't account for the case when at single x vaule there's more than one y value but that can be easily remedied.
    Simple validation of returned indexes would solve the issue:
    Qt Code:
    1. int prev = idx_start-1;
    2. while( prev >= 0 && curve.sample( idx_start ) == curve.sample( prev ) )
    3. {
    4. --prev;
    5. --idx_start;
    6. }
    7.  
    8. int next = idx_end+1;
    9. while( next < curve.dataSize() && curve.sample( idx_end ) == curve.sample( next ) )
    10. {
    11. ++next;
    12. ++idx_end;
    13. }
    To copy to clipboard, switch view to plain text mode 
    As to your second issue.
    If you want all points acroos x axis regardless if they fit on y axis in current zoom rectangle - above function can be used.
    If you want points acroos x axis only if they fit on y axis in current zoom rectangle - above function can be used.

    In the second case only work required on your part is to remove from the cut-out *data* segment points that overshoot upper and lower values of the zoom rectangle.

  2. The following user says thank you to Spitfire for this useful post:

    Hogwarts (7th June 2012)

Similar Threads

  1. Replies: 11
    Last Post: 29th May 2012, 15:00
  2. Replies: 1
    Last Post: 1st June 2011, 07:39
  3. Replies: 2
    Last Post: 14th February 2011, 13:42
  4. Replies: 4
    Last Post: 29th April 2010, 06:11
  5. Retrieve Curve values
    By nenukino in forum Qwt
    Replies: 2
    Last Post: 26th February 2008, 14:33

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
  •  
Qt is a trademark of The Qt Company.