Re: [ROOT] graphing huge datasets -- possible fix

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Mar 20 2002 - 08:46:48 MET


Hi Tony,

Sorry for this late reply. We are completly saturated by emails.
I have included your enhancement to TGX11::DrawPolyLine in the CVS source.
Thanks for sending this patch.

Rene Brun

Colley, Tony wrote:
> 
> Has anyone had time to examine this issue lately...
> 
> -----Original Message-----
> From: Colley, Tony
> Sent: Monday, March 04, 2002 17:01
> To: Colley, Tony; 'Faine, Valeri'; 'Eddy Offermann '
> Cc: 'roottalk@pcroot.cern.ch '
> Subject: RE: [ROOT] graphing huge datasets -- possible fix
> 
> I modified the DrawPolyLine function in TGX11.cxx to split polylines with
> too many points into drawable chunks. This would not handle the case where
> someone wanted to draw a filled curve with too many points; but I don't need
> really big filled curves anyway. This change enabled ROOT to successfully
> handle a TGraph of 10^7 points (not quickly, by any means, but at least it
> draws the graph and doesn't crash).
> 
> Here is a cvs diff output of my changes:
> 
> ===================================================================
> 654a655,657
> > #define MAX_DRAW_PTS 1000001
> > #define MDP_MINUS_1  1000000
> >
> 661d663
> <
> 664c666,678
> <    if (n > 1) {
> ---
> >    if (n > MAX_DRAW_PTS) {
> >       int ibeg = 0;
> >       int iend = MDP_MINUS_1;
> >       while (iend < n) {
> >          DrawPolyLine( MAX_DRAW_PTS, &xyt[ibeg] );
> >          ibeg = iend;
> >          iend += MDP_MINUS_1;
> >       }
> >       if (ibeg < n) {
> >          int npt = n - ibeg;
> >          DrawPolyLine( npt, &xyt[ibeg] );
> >       }
> >    } else if (n > 1) {
> 
> =====================================================================
> 
> Here's an extract from TGX11.cxx showing the modifications:
> 
> =====================================================================
> #define MAX_DRAW_PTS 1000001                               // NEW
> #define MDP_MINUS_1  1000000                               // NEW
> 
> void TGX11::DrawPolyLine(int n, TPoint *xyt)
> {
>    // Draw a line through all points.
>    // n         : number of points
>    // xy        : list of points
>    XPoint *xy = (XPoint*)xyt;
> 
>    if (n > MAX_DRAW_PTS) {                                 // NEW
>       int ibeg = 0;                                        // NEW
>       int iend = MDP_MINUS_1;                              // NEW
>       while (iend < n) {                                   // NEW
>          DrawPolyLine( MAX_DRAW_PTS, &xyt[ibeg] );         // NEW
>          ibeg = iend;                                      // NEW
>          iend += MDP_MINUS_1;                              // NEW
>       }                                                    // NEW
>       if (ibeg < n) {                                      // NEW
>          int npt = n - ibeg;                               // NEW
>          DrawPolyLine( npt, &xyt[ibeg] );                  // NEW
>       }                                                    // NEW
>    } else if (n > 1) {                                     // CHANGED
>       if (gLineStyle == LineSolid)
>          XDrawLines(fDisplay, gCws->drawing, *gGCline, xy, n,
> CoordModeOrigin);
>       else {
>          int i;
>          XSetDashes(fDisplay, *gGCdash,
>                     gDashOffset, gDashList, sizeof(gDashList));
>          XDrawLines(fDisplay, gCws->drawing, *gGCdash, xy, n,
> CoordModeOrigin);
> 
>          // calculate length of line to update dash offset
>          for (i = 1; i < n; i++) {
>             int dx = xy[i].x - xy[i-1].x;
>             int dy = xy[i].y - xy[i-1].y;
>             if (dx < 0) dx = - dx;
>             if (dy < 0) dy = - dy;
>             gDashOffset += dx > dy ? dx : dy;
>          }
>          gDashOffset %= gDashLength;
>       }
>    } else {
>       int px,py;
>       px=xy[0].x;
>       py=xy[0].y;
>       XDrawPoint(fDisplay, gCws->drawing,
>                  gLineStyle == LineSolid ? *gGCline : *gGCdash, px, py);
>    }
> }
> 
> =====================================================================
> 
> If this doesn't break something I didn't try, then I think it is a
> reasonable way to fix the 2^20 data point limit.
> 
> +------------------------------------------------+
> | Tony Colley                ITT Industries A/CD |
> | Modeling/Simulation Group  Fort Wayne, IN  USA |
> +------------------------------------------------+
> | Using ROOT 3.03/02 on RedHat Linux 7.2         |
> | Last CVS update: 26 Feb 2002 at 2218 GMT       |
> +------------------------------------------------+
> \I'm not responsible for anything below this line/
> 
> ************************************
> If this email is not intended for you, or you are not responsible for the
> delivery of this message to the addressee, please note that this message may
> contain ITT Privileged/Proprietary Information.  In such a case, you may not
> copy or deliver this message to anyone.  You should destroy this message and
> kindly notify the sender by reply email.  Information contained in this
> message that does not relate to the business of ITT is neither endorsed by
> nor attributable to ITT.
> ************************************



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:46 MET