Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!rpi!bu.edu!bbn.com!landheim From: landheim@bbn.com (Greg Landheim) Newsgroups: comp.graphics Subject: Re: surface plotting code Message-ID: <60366@bbn.BBN.COM> Date: 26 Oct 90 13:33:41 GMT References: <1990Oct21.155411.21230@uunet!unhd> Sender: news@bbn.com Reply-To: landheim@spcwsa.bbn.com (Greg Landheim) Distribution: comp Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 52 In article <1990Oct21.155411.21230@uunet!unhd> rg@unhd.UUCP (Roger Gonzalez ) writes: > >I'm looking for some code that will (on a PC, preferably, but I will port) > >- do a surface mesh from any orientation, reasonably optimized, with or > without hlr. >- draw a path traveled in 3-space above it. > >I already wrote some quickie code to do it, but its slow and warty. >Since I know that its been done a jillion times already, I am going to >be lazy and try to leach off the net-minds. I'll take subsets of what I >asked for as well, and if you happen to have a fractal landscape >generator that feeds your routines, all the better. I published two articles in the now-defunct Micro Cornucopia magazine last year which described an implementation of a 3-D surface plot routine, with hidden line removal. The surface can be viewed from any horizontal angle from 0 to 360 degrees, and vertical angles (above or below the X-Y plane) of -90 to +90 degrees). A bounding box can (optionally) be drawn around the surface. The source code was written for the PC in Turbo C 2.0 with the ANSI compatibility switch on. It included a driver to direct the output to a standard IBM printer in both portrait and landscape modes. The demo surface generator used the Mandelbrot set, and the demo program allowed the user to specify the Mandelbrot set region to generate, and choose whether to output to the printer or the CRT. The code is portable. I had little difficulty moving the demo program to a Unix X-Window environment. I think it took about an hour to do a quick and dirty port. Mostly, I had to get rid of all the function prototypes. The magazine published most, but not all, of the source. The complete source was available by mail or modem. But they are no longer in business. I make no claims to efficiency or speed for these routines, but they have proved highly reliable through a lot of use. (Oh, yeah, they also contain code for scalable, rotatable character strings). I don't even claim good coding style. But they are public domain, with no restrictions except not to blame me if you use them and something goes wrong. I wrote them specifically to give away, so other people could look at nice threed pictures with just one call to a function. Periodically, I get requests, usually by mail, for the source. I would like to make the entire contents of the disk I sent to Micro C available, but don't know where to put it. If someone will assume responsibility for putting it in the appropriate places, both Compuserve and some ftp site would be nice, I will send them the entire source disk. I'll also try to contact someone at Micro C and see if it's ok to include the text of the article. Greg Landheim