home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / 3d / 1542 < prev    next >
Encoding:
Text File  |  1992-11-20  |  3.4 KB  |  113 lines

  1. Newsgroups: alt.3d
  2. Path: sparky!uunet!mcsun!news.funet.fi!ajk.tele.fi!funic!nntp.hut.fi!taltta.hut.fi!f39423v
  3. From: f39423v@taltta.hut.fi (Samu Karanko)
  4. Subject: Re: RDS FTP Sites -> Two zval() functions for sirds
  5. Message-ID: <1992Nov20.103601.24824@nntp.hut.fi>
  6. Summary: Two ZVAL()'s for SIRDS. Man, what a compression ratio!
  7. Keywords: RDS FTP
  8. Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
  9. Nntp-Posting-Host: taltta.hut.fi
  10. Organization: Helsinki University of Technology, Finland
  11. References: <griffita.722162040@sfu.ca>
  12. Date: Fri, 20 Nov 1992 10:36:01 GMT
  13. Lines: 98
  14.  
  15. griffita@fraser.sfu.ca (David Stuart Griffiths) writes:
  16. >Can anyone tell me if/where there are any RDS FTP sites?  Preferably
  17. >with Postscript pictures in them?
  18.  
  19. Mr. Hornstein graciously provided us with a program to generate
  20. PostScript files of RDS images. He posted the C-source here about a
  21. week ago. (Thanks! It's been a while since I last appreciated
  22. computers this much!)
  23.  
  24. After sirds.c was posted somebody posted and requested for people's
  25. favorite RDS images generated with it. At the bottom I include two
  26. functions I wrote and liked. The other one is quite educational and the
  27. other is just plain fun.
  28.  
  29. The magic numbers in the functions assume you haven't tampered with
  30. any of the settings in the original sirds.c. (Height=800, Width=1200, etc) 
  31. Naughty of me...
  32.  
  33. BTW, if the PostScript files are 240k each, sending just the functions
  34. results in a compression ratio of about 1:600!!!
  35.  
  36. -- Samu Karanko
  37.  
  38.  
  39.  
  40. 1) It can be difficult to prove whether a certain point on a surface
  41. truly has a limit value. You might, however, easily prove the opposite
  42. by showing two different limits for the point when approached in two
  43. different ways. The first zval() is an example that was used by our
  44. lecturer when explaining the situation. Calculate it and see for
  45. yourself: 
  46.  
  47. /* Don't flame me if the math-words are wrong, I believe you get the meaning:
  48.  * A function that has no limit at origo. If you approach origo along any
  49.  * line, the limit is 0, but if you approach it along the curve y=x*x the 
  50.  * limit is 1/4. You may want to write the function with a pen to see behind
  51.  * the quite unclear computer format. The *75 is just for scaling.
  52.  */
  53.  
  54. int zval(x,y) 
  55. int x;
  56. int y;
  57. {
  58. double X=0, Y=0;
  59.  
  60. X = x -= 600; Y = y -= 400;
  61.  
  62. /* To add X- and Y-axes uncomment following. */
  63. /*if(((x > -5) && (x < 5)) || ((y > -5) && (x < 5)))
  64.   return (5);
  65. */
  66.  
  67. X /= 100; Y /= 100;
  68.  
  69. if((x==0) && (y==0))
  70.   return (0); /* Origo */
  71. return(((X*X*X*X*Y*Y)/((X*X*X*X+Y*Y)*(X*X*X*X+Y*Y)))*75);
  72.  
  73. }
  74.  
  75. 2) The second zval() makes two representations of the mandelbrot set.
  76. The other shows a circle (radius < 2), from which the mandelbrot set
  77. has been removed. And the other is the traditional coloring approach,
  78. but instead of the colors, height of point is used. I haven't had time
  79. to try any zooming so far, but you might get some nice scenery from
  80. the borderline by using the height of point technique. The whole set,
  81. however, look nicer with the first option.
  82.  
  83. /* The Mandelbrot set. Two alternatives for determining the height of the
  84.  * points. Comment out the one you don't want. The latter is better, IMO.
  85.  */
  86. int zval(x,y) 
  87. int x;
  88. int y;
  89. {
  90. double X=0, Y=0, A, B;
  91. int iter=0;
  92. x -= 600; y -= 400;
  93. A=(double)x; B=(double)y;
  94. A /= 200; B /= 200;
  95.  
  96. while(((X*X + Y*Y) < 4) && (iter < 100)) {
  97.     X = X*X - Y*Y + A;
  98.     Y = 2*X*Y + B;
  99.     iter++;
  100.       }
  101. /*
  102. if(iter >= 99)
  103.     return (0);
  104. return (iter/2);
  105. */
  106. if((iter >= 2) && (iter < 99))
  107.   return(20);
  108. return(0);
  109.  
  110. }
  111.  
  112. -  Samu
  113.