home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 17928 < prev    next >
Encoding:
Text File  |  1992-12-29  |  2.3 KB  |  68 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!gatech!destroyer!cs.ubc.ca!alberta!fletcher
  3. From: fletcher@cs.UAlberta.CA (Cocquyt Fletcher B)
  4. Subject: Symmetric Chaos
  5. Message-ID: <fletcher.725667758@manning>
  6. Keywords: Chaos symmetric
  7. Sender: news@cs.UAlberta.CA (News Administrator)
  8. Nntp-Posting-Host: manning.cs.ualberta.ca
  9. Organization: University of Alberta, Edmonton, Canada
  10. Date: Tue, 29 Dec 1992 22:22:38 GMT
  11. Lines: 55
  12.  
  13. In the December Scientific American they have an article "Christmas in the
  14. House of Chaos" by Ian Stewart pp 144-146.  They give some formulae 
  15. to generate images of symmetric chaos but they neglect to explain
  16. how to localize the patterns to the resolution of a standard monitor...
  17.  
  18. I've tried to implement it using x modulo WIDTH and y modulo HEIGHT
  19. but I don't get the desired results...here is my algorithm right now:
  20.  
  21. #define A 1.89   /* you can experiment with these constants */
  22. #define B -1.10
  23. #define C 0.17
  24. #define D -0.79
  25.  
  26.  
  27.   for( loop = 0; loop < somebignumber; loop++ )
  28.   {
  29.  
  30.     x=(((int)(A*x+B*x*(x*x+y*y)+C*(x*x*x-3*x*y*y)+D*(x*x-y*y))));
  31.     y=(((int)(A*y+B*y*(x*x+y*y)+C*(3*x*x*y-y*y*y)-2*D*x*y)));
  32. /*
  33.    x=(((int)(A*x+B*x*(x*x+y*y)+C*(x*x*x*x-6*x*x*y*y+y*y*y*y)+D*(x*x*x-3*x*y*y)))%WIDTH);
  34.    y=(((int)(A*x+B*x*(x*x+y*y)+C*(4*x*x*x*y-4*x*y*y*y)+D*(-3*x*x*y+y*y*y)))%NTSC_HEIGHT);
  35.  
  36.     x=abs(x);
  37.     y=abs(y);*/
  38.     printf("%d %d\n",x,y);
  39. /*
  40.     (*(cmap+WIDTH*y+x))++;   
  41.     SetAPen( &my_rast_port, ((int)((*(cmap+WIDTH*y+x))/11))%31);
  42.     WritePixel(&my_rast_port,x,y);*/
  43.   }
  44.  
  45.  
  46. The cmap just keeps track of how many times each point is "hit" by the 
  47. formulae...The colors then reveal a "frequency map" of the
  48. relative attractiveness of each point (Their pictures look nice!)
  49.  
  50. The commented out formulae are the ones for "three fold symmetry"
  51. and the others are for 4 fold.  In each case I get only 40 to 109
  52. points plotted over and over again...I was expecting more
  53. diversity...
  54.  
  55. Perhaps it is a problem with the way I take the mod and "disturb
  56. the mapping"?  Anyone have any idea how to implement this?
  57.  
  58. BTW my WIDTH was 352 pixels and NTSC_HEIGHT was 262...32 colors.
  59.  
  60. The division by 11 in the SetAPen line was to slow down the 
  61. rate the colors changed...
  62.  
  63. Any suggestions/comments are welcome!
  64.  
  65. -Fletch
  66.  
  67.  
  68.