home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / sci / fractals / 352 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.1 KB  |  60 lines

  1. Newsgroups: sci.fractals
  2. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!alf.uib.no!hsr.no!elektro2.hsr.no!DNORT
  3. From: DNORT@gribb.hsr.no (Johansen, Trond Robert 6-96)
  4. Subject: Help with making the PLASMA image in C
  5. Message-ID: <DNORT.1.722078665@gribb.hsr.no>
  6. Keywords: How to calculate the colours ?
  7. Lines: 47
  8. Sender: news@hsr.no
  9. Organization: Rogaland University Centre
  10. Date: Wed, 18 Nov 1992 09:24:25 GMT
  11. Lines: 47
  12.  
  13. I am new in fractals, but I am trying to learn about it by making my own 
  14. pictures. I am making a recursive function that is suppost to draw the 
  15. plasma picture. The functions get a rectangle and divides this rectangel 
  16. into four "simmular" rectangels inside the first, and so on. My problem now 
  17. is how to calculate the colours. I know that the colours (of the four 
  18. corners) depends uppon a random value, and the "mother" rectangle, but HOW 
  19. does it depend? I also know that when the rectangle is big (at the start of 
  20. recursion), then the colour depends more of the random than of the colours 
  21. of the "mother" rectangle.
  22.  
  23. The function that I have made is short and easy, and I'll explain what the 
  24. variables is here:
  25.  
  26. (x1,y1) Upper left corner of the rectangle
  27. (x2,y2) Lower rigt corner of the rectangle
  28. fov   Colour to upper left corner
  29. foh   Colour to upper right corner
  30. fnv   Colour to lower left corner
  31. fnh   Colour to lower right corner
  32.  
  33. Her is the function :
  34.  
  35. void plasma(int x1,int y1,int x2,int y2,
  36.         int fov,int foh,int fnv,int fnh)
  37.  
  38. {    
  39.     /*?????? Calculate the colours (fov,foh,fnv and fng) ?????????*/
  40.  
  41.     if (y2>y1+1)    
  42.     {  plasma(x1,y1,((x1+x2)>>1),((y1+y2)>>1),fov,foh,fnv,fnh);    
  43.        plasma(((x1+x2)>>1),y1,x2,((y1+y2)>>1),fov,foh,fnv,fnh);       
  44.        plasma(((x1+x2)>>1),((y1+y2)>>1),x2,y2,fov,foh,fnv,fnh);       
  45.        plasma(x1,((y1+y2)>>1),((x1+x2)>>1),y2,fov,foh,fnv,fnh);    
  46.     }       
  47.     else    
  48.     {  putpixel(x1,y1,fov);        
  49.        putpixel(x2,y1,foh);        
  50.        putpixel(x1,y2,fnv);
  51.            putpixel(x2,y2,fnh);
  52.     }
  53.  
  54.  
  55. I dont know if this is the kind of questions that peopel ask here, but 
  56. anyway I will be greatfull for all the help I gets.
  57.  
  58. Trond Robert Johansen
  59. DNORT@GRIBB.HSR.NO  (Internett)
  60.