### 3D Graphs

*
Robert Driver, Leeds, West Yorkshire
*

Here is a 3D Graphs program which will run on a 16K or 32K BBC Micro. It will plot any section of any function for Y in terms of X and Z as a wireframe or surface diagram with or without axes - the axes option is only ofTered if the chosen values for X and Z include the origin.

In the menu, the last function for Y, values for X and Z etc. are shown and can be left unaltered simply by pressing Return, or changed by typing in the new value. All the expressions are entered as strings and then EVALed. This is especially useful for trigonometrical functions where the values for X and Z may need to be interrns of PI, e.g.:-2*PI.

The menu is virtually foolproof: it will not accept a highest value for X lower than the lowest value for X. However, make sure that your function for Y is in terms of X and Z, and that there is no possibility of division by zero. There is an error-handling routine, but it is rather annoying to come and see how your wonderful graph is coming along, only to find that there was something wrong with the function.

The graph is then scaled by PROCscale which usually does its job, but for extra-special graphs some fiddling around may be called for: YT ALL is the height of the origin above the bottom of the screen, and YBIG is the number of graphics units per Y unit.

The graph is then plotted in Mode 4 by PROCplot. This procedure calls various other procedures according to whether a wire-frame or surface diagram is called for, and whether axes are wanted. Basically it calls PROCline or PROCaxisline from within a loop, which in turn call PROCfill or PROCsquare from within a loop.

If required the graph can be dumped up to nine times on to a printer by PROCdump. This was written for a Seikosha GP-250X but it should run on any Seikosha or Acorn graphics printer with perhaps a little modification. The VDUs at the beginning are to specify linefeed and graphics mode, and to print lots of spaces so that the graph is printed in the middle of the paper. Then the graph is plotted sideways . This is because a byte of screen memory represents a row of eight pixels, whereas a byte sent to the printer is printed as a column of eight dots.