[Kst] Displaying a huge number of points

Barth Netterfield barth.netterfield at utoronto.ca
Wed Mar 13 14:48:15 UTC 2013


Thanks for finding this, and sorry for the long delay.

Your fix is (almost) correct, though it does neglect a very important 
optimization.  

The correct line is:

 if (rect.contains(pt) && pt != lastPt &&
            (lastPt.isNull() || (abs(pt.x() - lastPt.x()) > size) || ((size==0) && 
(abs(pt.y() - lastPt.y()) > 0)))) {

This only adds a point to the list if it is in a different pixel than the 
previous point.

This does sunstantially speed up drawing in most cases where you have a 
huge number of points.  

I will commit this change.

Barth

On Thursday 28 February 2013 18:08:46 Janvrot wrote:
> Hello
> 
> I took some time to read the code for version 2.0.6 and I noticed that
> *curve.cpp *has, near line 1221
> 
>        if (rect.contains(pt) && pt != lastPt &&
>             (lastPt.isNull() || (abs(pt.x() - lastPt.x()) > size))) { // ||
> (abs(pt.y() - lastPt.y()) > size))) {
>             // select point to be ploted
> 
> When working with scatter charts, just points no lines, size ==0. This
> prevents plotting of points with the same X, but with different Y, which is
> desirable.
> When
>       if (hasLines() && pointDensity() != 0) {
>             // size is computed as a number between 15 and 139, according 
to
> dialog density setting,
> 
> So if we substitute *>* for *>=* on the above comparison everybody will 
be
> happy, I guess.
>       if (rect.contains(pt) && pt != lastPt &&
>             (lastPt.isNull() || (abs(pt.x() - lastPt.x()) *>=* size))) { //
> 
> || (abs(pt.y() - lastPt.y()) > size))) {
> 
> Did I get it right or there is a problem that I could not perceive?
> 
> Regards
> Janvrot
> 
> 
> 
> 
> 
> --
> View this message in context:
> http://kde.6490.n7.nabble.com/Displaying-a-huge-number-of-points-tp1521466p
> 1521807.html Sent from the kst mailing list archive at Nabble.com.
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
-- 
Barth Netterfield
University of Toronto
416-845-0946
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kst/attachments/20130313/ba2b2b13/attachment.html>


More information about the Kst mailing list