Path: utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!cornell!batcomputer!saponara From: saponara@batcomputer.tn.cornell.edu (John Saponara) Newsgroups: comp.graphics Subject: Re: Fractals! Message-ID: <4646@batcomputer.tn.cornell.edu> Date: 1 May 88 18:16:34 GMT References: <811@unioncs.UUCP> <1776@uhccux.UUCP> <5595@pyr.gatech.EDU> <4644@watdcsu.waterloo.edu> Reply-To: saponara@tcgould.tn.cornell.edu (Eric Haines, actually) Organization: 3D/Eye Inc Lines: 89 Keywords: Fractals, Stochastic Modeling Summary: Bug in SPD package - please fix. `diff' is attached. In article <4644@watdcsu.waterloo.edu> mmaclenn@watdcsu.waterloo.edu (Mark MacLennan-Geog.) writes: >[Code for generating a fractal mountain is also available in >Eric Grosse's "Standard Procedural Database" available from netlib's graphics >library - please DON'T send me mail on how to get this code, instead read about >netlib in the May 1987 issue of COMMUNICATIONS OF THE ACM, pp. 403-407.] Coincidentally enough, I was just using my SPD program mentioned above to generate some fractal mountains. I set the fractal dimension down to 2.02 to get a milder landscape and noticed some repetition in the pattern. Looking into it, I found my hashing function had a misplaced parenthesis and would blow up on landscapes with a size factor greater than 7, to boot. So, attached at the end is the `diff' to fix the SPD package. If you don't have the package, here's the 10 second rundown (my apologies to all who've read this before): The "Standard Procedural Database" package is a set of 6 database generators, including the recursive tetrahedron, a fractal mountain, and a tree grower. For images produced by the databases and more information on the concept, see the article in IEEE Computer Graphics & Applications, November 1987, p. 3-5. To get the package, send mail to Netlib (which has a lot of other worthwhile free stuff) at `netlib@anl-mcs.arpa' or at `research!netlib'. Send the one line message `Send Haines from Graphics' and the program which receives your message will send you a copy of the package. If you send the message (on a separate line) `Send Index' you'll get the index and more information about Netlib in general. Eric Grosse and Jack Dongarra run Netlib. I (Eric Haines) simply wrote the SPD package. OK, so for the rest of you who already have the package, here's the diff. Note that you should have version 2.3 to correctly update your package. Eric (not John Saponara) Haines p.s. The diff is indented for obscure `rn' reasons - please unindent. diff old/README README 4c4 < Version 2.3, as of 3/1/88 --- > Version 2.4, as of 5/1/88 20a21 > Version 2.4 released May, 1988 - fixed hashing function for mountain.c. diff old/mountain.c mountain.c 7c7,15 < * Version: 2.2 (11/17/87) --- > * NOTE: the hashing function used to generate the database originally is > * faulty. The function causes repetition to occur within the fractal > * mountain (obviously not very fractal behavior!). A new hashing function > * is included immediately after the old one: merely define NEW_HASH if > * you want to use a good hashing function. To perform ray tracing > * comparison tests you should still use the old, faulty database (it may > * have repetition, but it's still a good test image). > * > * Version: 2.4 (5/1/88) 26a35,37 > /* to use the corrected hashing function, uncomment this next line */ > /* #define NEW_HASH */ > 41c52,56 < /* hashing function to get a seed for the random number generator */ --- > #ifndef NEW_HASH > > /* Hashing function to get a seed for the random number generator. */ > /* This is the old, buggy hashing function - use it if you wish to > * obtain the same image as in the November 1987 IEEE CG&A article. */ 44a60,77 > #else > > /* New, corrected hashing function. Use for a true fractal mountain */ > /* 134456 is M1 in routine lib_gauss_rand() */ > #define hash_rand(A,B,C) ( ( C <= 15 ) ? \ > ( ABSOLUTE( \ > ((A)<<(31-(C))) \ > + ((B)<<(15-(C))) ) \ > % 134456 ) \ > : \ > ( ABSOLUTE( \ > ((A)<<(31-(C))) \ > + ((B)>>((C)-15)) ) \ > % 134456 ) \ > ) > > #endif > 56d88 <