Results 1 to 3 of 3

Thread: Get a smooth curve

  1. #1
    Join Date
    Dec 2009
    Location
    Toulouse
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Question Get a smooth curve

    Hi all

    I draw a simple x=y curve and the curve is not smooth.

    so i use :
    Qt Code:
    1. Curve->setRenderHint(QwtPlotItem::RenderAntialiased);
    To copy to clipboard, switch view to plain text mode 
    but if there is more than 100 points in the curve it's not smooth

    How can i do to obtain a smooth curve ?

    thank to all

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Get a smooth curve

    You can try to use a QwtCurveFitter:

    a) QwtSplineCurveFitter
    Spline interpolation avoids edges, when you don't have enough points.

    b) QwtWeedingCurveFitter
    This is an implementation of the Douglas-Peucker algorithm. In opposite to spline interpolation it decreases the number of points.

    I guess QwtWeedingCurveFitter is what you are looking for. Unfortunately this is a new class you find in Qwt SVN trunk only. But AFAIR the class is compatible with Qwt 5.2. So you can copy it into your code - or add it to your 5.2 package.

    Qt Code:
    1. QwtWeedingCurveFitter *fitter = new QwtWeedingCurveFitter();
    2. fitter->setTolerance(...);
    3. curve->setCurveFitter(fitter);
    4. curve->setCurveAttribute(QwtPlotCurve::Fitted, true);
    To copy to clipboard, switch view to plain text mode 

    Uwe

  3. #3
    Join Date
    Dec 2009
    Location
    Toulouse
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Get a smooth curve

    thank you Uwe

    i must not modify points of the curves
    it is better with orthonormal axes but i don't want it.

Similar Threads

  1. Smooth lines in QGraphicsView
    By JaRo999 in forum Qt Programming
    Replies: 4
    Last Post: 27th September 2009, 15:38
  2. Installing Qt Second time, not so smooth...
    By winston2020 in forum Installation and Deployment
    Replies: 3
    Last Post: 16th January 2009, 21:30
  3. Want to draw Curve
    By santhoshv84 in forum Qt Programming
    Replies: 1
    Last Post: 12th September 2008, 07:14
  4. Smooth pixmap transform in QGraphicsView problem
    By spud in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2007, 16:47
  5. setMask (smooth)
    By pakulo in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 08:51

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.