Contours  -  Contour map generator

by R Swetman

Contours generates a contour map (lines or loops representing 'height') of a 3D surface which is specified as a mathematical function of the form z = f(x, y).

There are nine such functions provided as examples within the program; examine DEF FN_Z(X,Y) at the end of the listing to see what they are. If you would like to try other mathematical functions, edit the default ones in these lines. Don't change the first one, though; it is a random 'terrain', and uses a coarser resolution than the others. Note that the program assumes that the range of x is (-15, 15), the range of y is (-12, 12) and the range of z is (-15, 15), so you should use some scaling factors as necessary.

Running the program will clear the screen and ask you to specify a function to plot. The functions can be chosen by pressing one of the number keys from 1 to 9, both at this stage and after a plot has taken place. The other keys that can be used after the initial plot has been made are as follows:

 C: double the number of contour lines
 R: double the resolution
 Tab: double both simultaneously

The default settings which the program assumes are a compromise between graphical detail and speed of plotting.

The display colours can be interpreted as follows:

 White: high ground or snow
 Green: lowland
 Blue: sea
 Red: deep water or 'hell'

The green/blue interface is 'sea-level'; i.e. the z = 0 plane.

 Copyright RISC User Magazine 1996
