View Full Version : Get a smooth curve
beekeep
6th January 2010, 15:51
Hi all
I draw a simple x=y curve and the curve is not smooth.
so i use :
Curve->setRenderHint(QwtPlotItem::RenderAntialiased);
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 ;)
Uwe
7th January 2010, 06:56
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.
QwtWeedingCurveFitter *fitter = new QwtWeedingCurveFitter();
fitter->setTolerance(...);
curve->setCurveFitter(fitter);
curve->setCurveAttribute(QwtPlotCurve::Fitted, true);
Uwe
beekeep
7th January 2010, 17:49
thank you Uwe
i must not modify points of the curves
it is better with orthonormal axes but i don't want it.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.