🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #443

Re: Using User Paths in a graphing program

#443
From: Paul Hagstrom
Date: Tue, 04 Aug 1992 20:45
45 lines
3011 bytes
In article <8003@dirac.physics.purdue.edu> murphy@gibbs.physics.purdue.edu  
(William J. Murphy) writes:
> 
> I am aware that user paths may provide an increase in speed of drawing in 
> a program that for instance plots data points.  What I don't know is where 
> to find a good reference for how to set them up and use them sensibly.
> For now, my plotView would have to cycle through the data every time the view
> parameters were changed.  That seems wasteful.  Particularly, when one draws
> thousands of symbols, the delay can be tremendously long, try it in nxyplot
> some time.  I have considered creating a font for the symbol part and already
> have a font example I did for another program.  Would that decrease the
> rendering time significantly?
> 
> So, what/where are some good examples of using user paths? (I prefer simple
> illustrative examples)  Would fontifying the symbols increase the drawing
> speed?
> 
> Thanks,
> Bill Murphy               | Old Home Cottage Cheese:  The only cottage 
> 			  | cheese that's not made from formaldehyde, 
> murphy@physics.purdue.edu | arsenic, or rodent parts.

Using user paths managed to speed up plotting by quite a significant amount in  
the differential equation plotting program that I've been working on..  They  
are not very difficult to use, but there are a couple of things that you need  
to watch out for.. The main one worth mentioning is this: don't let yourself  
get a path that is more than 32767 elements long.. it takes an int as an  
argument, and it is easy to forget that.. 

To create a user path, you just need to allocate two arrays (a "coordinate"  
array and an "operator" array) and then send them to DSPDoUserPath().  For all  
of the commands, look in the documentation for DPSDoUserPath(); it is pretty  
complete.  Additionally, there is a nice little example program in there which  
draws vertical lines and should show you enough about how to do it.  Another  
thing to be watchful for: I've always had to do a dps_setbbox first.  I'm not  
sure why, but it had tendencies not to work otherwise, so I just dps_setbbox to  
the size of the entire view before doing anything further.

Anyway, I hope that is of some help anyway.. I REALLY LIKE User Paths and do my  
best to refrain from plotting any other way.  The disadvantages are the size  
limitation and the fact that you can't change the color in mid-path (at least  
as far as I know), but the speed outweighs all of those.
-------------
Paul Hagstrom (hagstrop@carleton.edu)
        "I could tell from her eyes that she'd just taken out a loan..."
Technical Details
Message-ID: <l7tr3iINN7pl@news.bbn.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!news.bbn.com!news.bbn.com!news
References: <8003@dirac.physics.purdue.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!news.bbn.com!news.bbn.com!news
From: hagstrop@oberon.mathcs.carleton.edu (Paul Hagstrom)
Newsgroups: comp.sys.next.programmer
Subject: Re: Using User Paths in a graphing program
Message-ID: <l7tr3iINN7pl@news.bbn.com>
Date: 4 Aug 92 20:45:38 GMT
References: <8003@dirac.physics.purdue.edu>
Lines: 45
NNTP-Posting-Host: bbn.com