xtopo

Calculate and graphically display a topographic map of an artificial landscape

Authored and Contributed by
Ronald Joe Record
Restrictions
Copyright 1993, 1994 Ronald Joe Record
Availability
The mathrec source code is freely redistributable. The author maintains binary distributions for Caldera OpenLinux 3.1, OpenServer, UnixWare 7 and Open UNIX 8. These distributions and the source code are available via:

Binary Distributions
OpenLinux/Open UNIX ftp://ftp2.sco.com/pub/.../RPMS/mathrec-1.1c-1col.i586.rpm (no longer available)
UnixWare 7 ftp://ftp2.sco.com/pub/skunkware/uw7/Packages/mathrec-1.1b.pkg
OpenServer ftp://ftp2.sco.com/pub/skunkware/osr5/vols/mathrec-1.1c-VOLS.tar

Source Code Distributions
Source RPM ftp://ftp2.sco.com/pub/.../SRPMS/mathrec-1.1c-1col.src.rpm (no longer available)
Gzip'd tar archive ftp://ftp2.sco.com/pub/skunkware/src/x11/misc/mathrec-1.1c.tar.gz

Description
The idea here is to calculate and display a fractal landscape topographically. In order to accomplish this, a midpoint displacement algorithm is used. The colors in the image represent heights in the landscape. Landscapes of varying "roughness" or "smoothness" can be calculated by varying the parameter "beta" which controls the fractal dimension.
Acknowledgements
The algorithm was derived from lectures given by Dietmar Saupe at the University of California at Santa Cruz. Assistance with colormaps and spinning color wheels and X was gleaned from Hiram Clawson and Stacey Campbell.
Build
To build the xtopo binary, either use the Imakefile or the sample makefile, Makefile.std. If your system doesn't support prototypes, uncomment the PROTODEFINE line of the Imakefile.

After modifying the Imakefile appropriately, either use "xmkmf" or "imake" to create a Makefile. Then just type "make" to compile xtopo.

The manual page can be formatted by typing "nroff -man xtopo.man > xtopo.1".

Install
To install xtopo, copy the xtopo binary to the desired location (the sample makefile puts it in /usr/local/bin) Copy the formatted man page to wherever you keep your local doc (i use /usr/local/man/cat1 for imaging software), then add that location to your MANPATH.
Safety
I have used it for several years without harm.
Work Planned
None
Documentation
manual page.
Verification
You can test xtopo by just invoking it with no arguments. It should display a 512x512 image. Some workstations may be slow to calculate and display a map as there are lots of calculations involved. On a DECstation 5000/200 with 32 Mb memory, "time ./xtopo -V -d" gave a test timing of :
real    0m17.46s
user    0m5.30s
sys     0m1.10s
On a Compaq 33 MHz 386 with no co-processor and 10 Mb memory, the same command gave results of :
real    4m18.09s
user    4m7.32s
sys     0m2.20s
Some "interesting" ways to run xtopo are as follows :
% xtopo -F -S 0 -m 0 -r -n 10 -d
(use the full screen, set sea level to 0, minimum upper color index to 0, randomly select beta for each map, calculate 10 maps in demo mode)
% xtopo -R -H 0.9
(display on the root window a landscape with paramter beta equal to 0.9)
% xtopo -o topomap.ppm
(calculate and display with default parameters and save the resulting image as a PPM file called topomap.ppm. this can be viewed later using xv or any PPM viewing utility)
Ideas, comments, additions, deletions, suggestions, bug reports, code review
e-mail Ronald Record at rr@ronrecord.com