home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.3d
- Path: sparky!uunet!mcsun!news.funet.fi!ajk.tele.fi!funic!nntp.hut.fi!taltta.hut.fi!f39423v
- From: f39423v@taltta.hut.fi (Samu Karanko)
- Subject: Re: RDS FTP Sites -> Two zval() functions for sirds
- Message-ID: <1992Nov20.103601.24824@nntp.hut.fi>
- Summary: Two ZVAL()'s for SIRDS. Man, what a compression ratio!
- Keywords: RDS FTP
- Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
- Nntp-Posting-Host: taltta.hut.fi
- Organization: Helsinki University of Technology, Finland
- References: <griffita.722162040@sfu.ca>
- Date: Fri, 20 Nov 1992 10:36:01 GMT
- Lines: 98
-
- griffita@fraser.sfu.ca (David Stuart Griffiths) writes:
- >Can anyone tell me if/where there are any RDS FTP sites? Preferably
- >with Postscript pictures in them?
-
- Mr. Hornstein graciously provided us with a program to generate
- PostScript files of RDS images. He posted the C-source here about a
- week ago. (Thanks! It's been a while since I last appreciated
- computers this much!)
-
- After sirds.c was posted somebody posted and requested for people's
- favorite RDS images generated with it. At the bottom I include two
- functions I wrote and liked. The other one is quite educational and the
- other is just plain fun.
-
- The magic numbers in the functions assume you haven't tampered with
- any of the settings in the original sirds.c. (Height=800, Width=1200, etc)
- Naughty of me...
-
- BTW, if the PostScript files are 240k each, sending just the functions
- results in a compression ratio of about 1:600!!!
-
- -- Samu Karanko
-
-
-
- 1) It can be difficult to prove whether a certain point on a surface
- truly has a limit value. You might, however, easily prove the opposite
- by showing two different limits for the point when approached in two
- different ways. The first zval() is an example that was used by our
- lecturer when explaining the situation. Calculate it and see for
- yourself:
-
- /* Don't flame me if the math-words are wrong, I believe you get the meaning:
- * A function that has no limit at origo. If you approach origo along any
- * line, the limit is 0, but if you approach it along the curve y=x*x the
- * limit is 1/4. You may want to write the function with a pen to see behind
- * the quite unclear computer format. The *75 is just for scaling.
- */
-
- int zval(x,y)
- int x;
- int y;
- {
- double X=0, Y=0;
-
- X = x -= 600; Y = y -= 400;
-
- /* To add X- and Y-axes uncomment following. */
- /*if(((x > -5) && (x < 5)) || ((y > -5) && (x < 5)))
- return (5);
- */
-
- X /= 100; Y /= 100;
-
- if((x==0) && (y==0))
- return (0); /* Origo */
- return(((X*X*X*X*Y*Y)/((X*X*X*X+Y*Y)*(X*X*X*X+Y*Y)))*75);
-
- }
-
- 2) The second zval() makes two representations of the mandelbrot set.
- The other shows a circle (radius < 2), from which the mandelbrot set
- has been removed. And the other is the traditional coloring approach,
- but instead of the colors, height of point is used. I haven't had time
- to try any zooming so far, but you might get some nice scenery from
- the borderline by using the height of point technique. The whole set,
- however, look nicer with the first option.
-
- /* The Mandelbrot set. Two alternatives for determining the height of the
- * points. Comment out the one you don't want. The latter is better, IMO.
- */
- int zval(x,y)
- int x;
- int y;
- {
- double X=0, Y=0, A, B;
- int iter=0;
- x -= 600; y -= 400;
- A=(double)x; B=(double)y;
- A /= 200; B /= 200;
-
- while(((X*X + Y*Y) < 4) && (iter < 100)) {
- X = X*X - Y*Y + A;
- Y = 2*X*Y + B;
- iter++;
- }
- /*
- if(iter >= 99)
- return (0);
- return (iter/2);
- */
- if((iter >= 2) && (iter < 99))
- return(20);
- return(0);
-
- }
-
- - Samu
-