how to draw a long curve quickly?
I want to draw a curve in QGraphicsScene and it is composed by about 100,000 points. how to draw it quickly?
I want to draw part of it at first,when user drag mouse,I draw another part according the mouse moves,but i do not know how to realize it?
do you have the other method?
Re: how to draw a long curve quickly?
Re: how to draw a long curve quickly?
Thk u for your answer.
I know that use QPainterPathand QGraphicsPathItem to
create a curve.
My question is that when the points number is vevy large ,for example,100,000,how to draw it quickly?
Re: how to draw a long curve quickly?
You don't. If the number of points is large then it takes longer to draw them than when there is fewer of them. Optimize your point count and cache whatever you can.
Re: how to draw a long curve quickly?
â€cache whatever you can“,sorry,I do not know what it means.
Re: how to draw a long curve quickly?
Keep intermediate values in memory instead of recalculating them each and every time when you need to use them.
Re: how to draw a long curve quickly?
I want to draw a curve in QGraphicsScene and it is composed by about 100,000 points. when I draw it all at
first,it will cost a long time.
I think if I should draw apart of it,and draw other part according user's draging the scroll bar.
Re: how to draw a long curve quickly?
Yes, you can segment your path and draw only those segments that are visible. You can also render your whole path to a pixmap and then just render the pixmap instead of stroking the path in each frame (especially if your path is static).