Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, July 2007
How to draw a smooth curve to fit a given list of points


Message 1 in thread

Hi,

Could anyone suggest me a simple way to draw a smooth curve to fit a given
list of points? Those points are well positioned, actully they do not
deviate much from a straight line.
Thanks,

Limin

Message 2 in thread

Have a look at the Qwt:

http://qwt.sourceforge.net/curvescreenshots.html

or you can do it yourself with QPainterPath:

http://doc.trolltech.com/4.3/qpainterpath.html#composing-a-qpainterpath

Cheers,
Peter

> -----Original Message-----
> From: Limin Fu [mailto:phoolimin@xxxxxxxxx]
> Sent: Thursday, July 05, 2007 12:53 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: How to draw a smooth curve to fit a given list of points
> 
> Hi,
> 
> Could anyone suggest me a simple way to draw a smooth curve to fit a
given
> list of points? Those points are well positioned, actully they do not
> deviate much from a straight line.
> Thanks,
> 
> Limin

--
 [ signature omitted ] 

Message 3 in thread

Thanks.
I had a look at Qwt, it can solve my problem, If I can not find an
alternative solution, I will use it. For using QPainterPath, the problem is
setting proper control points for building bezier curves, I was trying to
think in this direction. Maybe I will find a simple heuristic way to specify
the control points.
cheers,

Limin

On 7/5/07, Peter Prade <prade@xxxxxxxxxxx> wrote:
>
> Have a look at the Qwt:
>
> http://qwt.sourceforge.net/curvescreenshots.html
>
> or you can do it yourself with QPainterPath:
>
> http://doc.trolltech.com/4.3/qpainterpath.html#composing-a-qpainterpath
>
> Cheers,
> Peter
>
> > -----Original Message-----
> > From: Limin Fu [mailto:phoolimin@xxxxxxxxx]
> > Sent: Thursday, July 05, 2007 12:53 PM
> > To: qt-interest@xxxxxxxxxxxxx
> > Subject: How to draw a smooth curve to fit a given list of points
> >
> > Hi,
> >
> > Could anyone suggest me a simple way to draw a smooth curve to fit a
> given
> > list of points? Those points are well positioned, actully they do not
> > deviate much from a straight line.
> > Thanks,
> >
> > Limin
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

Message 4 in thread

Limin Fu wrote:

> I had a look at Qwt, it can solve my problem, If I can not find an
> alternative solution, I will use it.

The code you need is in QwtSpline. This is a quite isolated class, so if you
don't want to include the complete Qwt package take the code and adopt it
to your situation.

HTH,
Uwe

--
 [ signature omitted ]